Merge branch 'Release/FixReloadConditionPArams'

This commit is contained in:
Samuele Locatelli
2022-12-12 20:11:00 +01:00
33 changed files with 651 additions and 410 deletions
+34 -2
View File
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MP.Data.DatabaseModels;
using NLog;
@@ -27,12 +28,43 @@ namespace MP.Data.Controllers
{
_configuration = null;
}
#region gestione lotti esterni
/// <summary>
/// Elenco lotti esterni presenti sul db di ARCA
/// </summary>
/// <param name="codArt">Codice articolo</param>
/// <param name="codLotto">Codice lotto</param>
/// <param name="codMagazzino">Codice magazzino</param>
/// <returns></returns>
public List<AnagLottiArca> ListLottiEsterni(string codArt, string codLotto, string codMagazzino)
{
List<AnagLottiArca> dbResult = new List<AnagLottiArca>();
using (var dbCtx = new MoonPro_ISContext(_configuration))
{
var DataGiac = new SqlParameter("@DataGiac", DateTime.Now);
var CodArt = new SqlParameter("@CodArt", codArt);
var CodLotto = new SqlParameter("@CodLotto", codLotto);
var CodMagaz = new SqlParameter("@CodMagaz", codMagazzino);
var OnlyTest = new SqlParameter("@OnlyTest", false);
dbResult = dbCtx
.DbLottoArca
.FromSqlRaw("exec dbo.stp_GIAC_getByDate @DataGiac,@CodArt,@CodLotto,@CodMagaz,@OnlyTest", DataGiac, CodArt, CodLotto, CodMagaz, OnlyTest)
.AsNoTracking()
//.AsEnumerable()
.ToList();
}
return dbResult;
}
#endregion gestione lotti esterni
#region gestione articoli
/// <summary>
/// articolo MAG corrispondente all' articolo selezionato
/// </summary>
/// <param name="artSearch"></param>
/// <param name="artSearch"></param>
/// <returns></returns>
public AnagArticoli_MAG artBySearch(string artSearch)
{
+1
View File
@@ -861,6 +861,7 @@ namespace MP.Data.Controllers
public async Task<bool> ODLClose(int idxOdl, string idxMacchina, int matrOpr, bool confPezzi, bool confRett, int modoConfProd)
{
bool fatto = false;
await Task.Delay(1);
if (idxOdl > 0)
{
using (var dbCtx = new MoonProContext(_configuration))
+7 -3
View File
@@ -1,13 +1,17 @@
using System;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MP.Data.DatabaseModels
{
[Keyless]
public partial class AnagLottiArca
{
public string Cd_MGEsercizio { get; set; }
public string Cd_MG { get; set; }
public string Cd_AR { get; set; }
@@ -15,8 +19,8 @@ namespace MP.Data.DatabaseModels
public string Cd_MGUbicazione { get; set; }
public string Cd_ARLotto { get; set; }
public string Cd_DoSottoCommessa { get; set; }
public decimal Quantita { get; set; }
public decimal Valore { get; set; }
public string Quantita { get; set; }
public string Valore { get; set; }
public string IniQ { get; set; }
public string IniV { get; set; }
public string RetQ { get; set; }
+89
View File
@@ -0,0 +1,89 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.Extensions.Configuration;
using MP.Data.DatabaseModels;
using NLog;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data
{
public partial class MoonPro_ISContext : DbContext
{
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private IConfiguration _configuration;
#endregion Private Fields
#region Public Constructors
/// <summary>
/// Indispensabile x prima generazione migrations EFCore
/// </summary>
[Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")]
public MoonPro_ISContext()
{
}
public MoonPro_ISContext(IConfiguration configuration)
{
_configuration = configuration;
}
public MoonPro_ISContext(DbContextOptions<MoonPro_InveContext> options) : base(options)
{
}
#endregion Public Constructors
#region Public Properties
#region PER INVE
public virtual DbSet<AnagLottiArca> DbLottoArca { get; set; }
#endregion PER INVE
#endregion Public Properties
#region Private Methods
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
#endregion Private Methods
#region Protected Methods
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
string connString = _configuration.GetConnectionString("Mp.IS");
if (!string.IsNullOrEmpty(connString))
{
optionsBuilder.UseSqlServer(connString);
}
else
{
optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro_IS_EdilChim;Trusted_Connection=True;");
}
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
OnModelCreatingPartial(modelBuilder);
}
#endregion Protected Methods
}
}
+1
View File
@@ -53,6 +53,7 @@ namespace MP.Data
public virtual DbSet<AnagUdcModel> DbUdcData { get; set; }
public virtual DbSet<AnagLottoModel> DbLottoData { get; set; }
public virtual DbSet<AnagArticoli_MAG> DbArtMag { get; set; }
public virtual DbSet<AnagLottiArca> DbLottoArca { get; set; }
#endregion PER INVE
#region PER SPEC
+1 -1
View File
@@ -94,7 +94,7 @@
{
<td>
<!-- Button trigger modal -->
<button type="button" class="btn btn-dark" data-bs-toggle="modal" data-bs-target="#exampleModal" @onclick="()=> getCurrSess(item.InveSessID)" title="Apri qr per connettersi alla sessione">
<button type="button" class="btn btn-dark" data-bs-toggle="modal" data-bs-target="#exampleModal" @onclick="()=> getCurrSess(item.InveSessID, item.AnagMagNav.CodMag)" title="Apri qr per connettersi alla sessione">
<i class="fa-solid fa-qrcode"></i>
</button>
</td>
+5 -2
View File
@@ -97,7 +97,7 @@ namespace MP.INVE.Components
get
{
string answ = "";
answ = $"{BaseUrlTab}IdSessione={currIdSess}&MatrOpr={idOperatore}&UserAuthKey={authKey}";
answ = $"{BaseUrlTab}IdSessione={currIdSess}&IdMag={currIdMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}";
return answ;
}
}
@@ -111,9 +111,10 @@ namespace MP.INVE.Components
}
}
protected async Task getCurrSess(int idSess)
protected async Task getCurrSess(int idSess, string idMag)
{
currIdSess = idSess;
currIdMag = idMag;
await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}");
await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode);
}
@@ -188,6 +189,8 @@ namespace MP.INVE.Components
[Parameter]
public int currIdSess { get; set; }
[Parameter]
public string currIdMag { get; set; }
[Inject]
private MiDataService MIDataservice { get; set; } = null!;
+8 -9
View File
@@ -57,7 +57,7 @@
</div>
</li>
</ul>
<div class="btn-group col-12" role="group" aria-label="Basic example">
<div class="btn-group col-12" role="group">
@if (articoloScan != "" && quantitaScan != 0)
{
<button type="button" class="btn btn-success col-6" @onclick="()=>insertScan()">Conferma</button>
@@ -79,7 +79,7 @@
}
else if (alreadyScan != null)
{
<ul class="p-0">
<ul class="p-0 mb-1">
<li class="list-group-item">
Codice Scannerizzato:
<div class="input-group input-group-sm">
@@ -119,7 +119,7 @@ else if (alreadyScan != null)
</div>
</li>
</ul>
<div class="btn-group col-12" role="group" aria-label="Basic example">
<div class="btn-group col-12 mb-1" role="group">
@if (!alreadyScan.IsUnique)
{
<button type="button" class="btn btn-success col-6" @onclick="()=>insertScan()">Conferma</button>
@@ -127,9 +127,8 @@ else if (alreadyScan != null)
}
else
{
<div class="alert bg-warning col-12">Questo oggetto risulta essere univoco perciò non è possibile salvare una nuova scansione</div>
<div class="alert bg-warning col-12 p-2 mb-0">Trovato UDC | scansione già effettuata / UDC caricato (impossibile caricare 2 volte)</div>
}
</div>
}
else
@@ -145,7 +144,7 @@ else
<li class="list-group-item">
Articolo:
<div class="input-group input-group-sm">
@if (lastScan != null && lastScan != "")
@if (!string.IsNullOrEmpty(lastScan))
{
<input class="form-control " @bind-value="@articoloScan" type="text" />
}
@@ -159,7 +158,7 @@ else
<li class="list-group-item">
Quantità:
<div class="input-group input-group-sm">
@if (lastScan != null && lastScan != "")
@if (!string.IsNullOrEmpty(lastScan))
{
<input class="form-control" @bind-value="@quantitaScan" type="number" />
}
@@ -172,7 +171,7 @@ else
<li class="list-group-item">
Note:
<div class="input-group input-group-sm">
@if (lastScan != null && lastScan != "")
@if (!string.IsNullOrEmpty(lastScan))
{
<input class="form-control " @bind-value="@noteScan" type="text" />
}
@@ -183,7 +182,7 @@ else
</div>
</li>
</ul>
<div class="btn-group col-12" role="group" aria-label="Basic example">
<div class="btn-group col-12" role="group">
@if (articoloScan != "" && quantitaScan != 0)
{
<button type="button" class="btn btn-success col-6" @onclick="()=>insertScan()">Conferma</button>
+156 -129
View File
@@ -27,13 +27,15 @@ namespace MP.INVE.Components
[Inject]
private MiDataService MIService { get; set; } = null!;
[Parameter]
public string lastScan { get; set; } = null!;
public string lastScan { get; set; } = "";
//[Parameter]
//public EventCallback<AnagUdcModel> udcSend { get; set; }
[Parameter]
public string userScan { get; set; } = null!;
[Parameter]
public int sessID { get; set; } = 0;
[Parameter]
public string magID { get; set; } = "";
[Inject]
public IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
@@ -42,10 +44,12 @@ namespace MP.INVE.Components
private string canMod = "false";
protected List<AnagUdcModel>? searchRecordsUDC;
protected List<AnagLottoModel>? searchRecordsLotto;
protected List<AnagLottoModel>? searchRecordsLottoInterni;
protected List<AnagLottiArca>? searchRecordsLottoEsterni;
protected List<ScanDataModel>? elencoScansioni;
protected AnagUdcModel? udc;
protected AnagLottoModel? lotto;
protected AnagLottoModel? lottoInterno;
protected AnagLottiArca? lottoEsterno;
protected ScanDataModel? alreadyScan;
protected AnagUdcModel? currUdc;
@@ -65,69 +69,93 @@ namespace MP.INVE.Components
protected override async Task OnParametersSetAsync()
{
await MIService.ConfigResetCache();
var result = await MIService.tryGetConfig("MAG_SmartUdcEdit");
elencoScansioni = MIService.ScanList();
var exists = elencoScansioni.Select(x => x.ScanValue).Contains(lastScan);
var scansioneClone = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault();
if (exists)
// se il valore scansionato è != null...
if (string.IsNullOrEmpty(lastScan))
{
if (scansioneClone != null)
{
isScannedLotto = scansioneClone.ScanValue.StartsWith("M2");
isMod = true;
if (scansioneClone.IsUnique)
{
isMod = false;
}
alreadyScan = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault();
currUdc = null;
currLotto = null;
}
await Task.Delay(1);
}
else
{
if (result != null)
{
canMod = result;
}
await Task.Delay(1);
searchRecordsUDC = MIService.ElencoUDC();
udc = searchRecordsUDC.Where(x => x.UDC == lastScan).FirstOrDefault();
await MIService.ConfigResetCache();
var result = await MIService.tryGetConfig("MAG_SmartUdcEdit");
elencoScansioni = MIService.ScanList();
var exists = elencoScansioni.Select(x => x.ScanValue).Contains(lastScan);
var scansioneClone = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault();
if (udc != null && !udc.UDC.Contains("MSL"))
if (exists)
{
if (scansioneClone != null)
{
isScannedLotto = scansioneClone.ScanValue.StartsWith("M2");
isMod = true;
if (scansioneClone.IsUnique)
{
isMod = false;
}
alreadyScan = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault();
currUdc = null;
currLotto = null;
currUdc = udc;
tipo = "UDC";
lottoScan = udc.lottoNav.Lotto;
articoloScan = udc.lottoNav.CodArt;
quantitaScan = udc.Qta;
noteScan = udc.Note;
}
}
else
{
searchRecordsLotto = MIService.ElencoLotti();
lotto = searchRecordsLotto.Where(x => x.Lotto == lastScan).FirstOrDefault();
if (lotto != null)
if (result != null)
{
tipo = "LOTTO";
currLotto = lotto;
lottoScan = lotto.Lotto;
articoloScan = lotto.CodArt;
quantitaScan = 0;
canMod = result;
}
await Task.Delay(1);
searchRecordsUDC = MIService.ElencoUDC();
udc = searchRecordsUDC.Where(x => x.UDC == lastScan).FirstOrDefault();
if (udc != null && !udc.UDC.Contains("MSL"))
{
currUdc = udc;
tipo = "UDC";
lottoScan = udc.lottoNav.Lotto;
articoloScan = udc.lottoNav.CodArt;
quantitaScan = udc.Qta;
noteScan = udc.Note;
}
else
{
currLotto = null;
currUdc = null;
alreadyScan = null;
lottoScan = lastScan;
articoloScan = "";
quantitaScan = 0;
noteScan = "";
if (lastScan.StartsWith("M") && lastScan.Length == 10)
{
searchRecordsLottoInterni = MIService.ElencoLotti();
lottoInterno = searchRecordsLottoInterni.Where(x => (x.Lotto == lastScan) && x.Origine == "INT").FirstOrDefault();
}
else
{
searchRecordsLottoEsterni = MIService.ListLottiEsterni(articoloScan, lastScan, magID);
lottoEsterno = searchRecordsLottoEsterni.FirstOrDefault();
}
if (lottoInterno != null)
{
tipo = "LOTTO";
currLotto = lottoInterno;
lottoScan = lottoInterno.Lotto;
articoloScan = lottoInterno.CodArt;
quantitaScan = 0;
}
else
{
if (lottoEsterno != null)
{
tipo = "LOTTO EXT";
quantitaScan = 0;
}
else
{
currLotto = null;
currUdc = null;
alreadyScan = null;
lottoScan = lastScan;
articoloScan = "";
quantitaScan = 0;
noteScan = "";
}
}
}
}
}
@@ -137,96 +165,95 @@ namespace MP.INVE.Components
protected decimal qtaLotto = 0;
protected async void insertScan()
{
var artExists = await MIService.artBySearch(articoloScan);
if (artExists != null)
{
var alertInsert = await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler salvare la seguente scansione per la sessione {sessID}?");
if (alertInsert)
//var alertInsert = await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler salvare la seguente scansione per la sessione {sessID}?");
//if (alertInsert)
//{
if (currUdc != null)
{
if (currUdc != null)
if ((currUdc.lottoNav.CodArt != udc.lottoNav.CodArt) || (currUdc.Qta != udc.Qta))
{
if ((currUdc.lottoNav.CodArt != udc.lottoNav.CodArt) || (currUdc.Qta != udc.Qta))
{
isForced = true;
}
//if()
ScanDataModel newScan = new ScanDataModel()
{
DtScan = DateTime.Now,
UserScan = userScan,
ScanValue = lastScan,
IsForced = isForced,
CodArticolo = currUdc.lottoNav.CodArt,
Lotto = currUdc.lottoNav.Lotto,
RifExt = currUdc.lottoNav.RifExt,
Qty = currUdc.Qta,
Note = currUdc.Note,
IsKnown = true,
IsUnique = true,
InveSessID = sessID
};
await MIService.InsertNewScansione(newScan);
NavManager.NavigateTo(NavManager.Uri, true);
isForced = true;
}
else if (currLotto != null)
//if()
ScanDataModel newScan = new ScanDataModel()
{
ScanDataModel newScan = new ScanDataModel()
{
DtScan = DateTime.Now,
UserScan = userScan,
ScanValue = lastScan,
IsForced = true,
CodArticolo = currLotto.CodArt,
Lotto = currLotto.Lotto,
RifExt = currLotto.RifExt,
Qty = qtaLotto,
Note = currLotto.Note,
IsKnown = true,
IsUnique = false,
InveSessID = sessID
};
await MIService.InsertNewScansione(newScan);
NavManager.NavigateTo(NavManager.Uri, true);
}
else if (alreadyScan != null)
{
ScanDataModel newScan = new ScanDataModel()
{
DtScan = DateTime.Now,
UserScan = userScan,
ScanValue = lastScan,
IsForced = true,
CodArticolo = alreadyScan.CodArticolo,
Lotto = alreadyScan.Lotto,
RifExt = alreadyScan.RifExt,
Qty = alreadyScan.Qty,
Note = alreadyScan.Note,
IsKnown = alreadyScan.IsKnown,
IsUnique = alreadyScan.IsUnique,
InveSessID = sessID
};
await MIService.InsertNewScansione(newScan);
NavManager.NavigateTo(NavManager.Uri, true);
}
}
else
{
currLotto = null;
currUdc = null;
alreadyScan = null;
DtScan = DateTime.Now,
UserScan = userScan,
ScanValue = lastScan,
IsForced = isForced,
CodArticolo = currUdc.lottoNav.CodArt,
Lotto = currUdc.lottoNav.Lotto,
RifExt = currUdc.lottoNav.RifExt,
Qty = currUdc.Qta,
Note = currUdc.Note,
IsKnown = true,
IsUnique = true,
InveSessID = sessID
};
await MIService.InsertNewScansione(newScan);
NavManager.NavigateTo(NavManager.Uri, true);
}
else if (currLotto != null)
{
ScanDataModel newScan = new ScanDataModel()
{
DtScan = DateTime.Now,
UserScan = userScan,
ScanValue = lastScan,
IsForced = true,
CodArticolo = currLotto.CodArt,
Lotto = currLotto.Lotto,
RifExt = currLotto.RifExt,
Qty = qtaLotto,
Note = currLotto.Note,
IsKnown = true,
IsUnique = false,
InveSessID = sessID
};
await MIService.InsertNewScansione(newScan);
NavManager.NavigateTo(NavManager.Uri, true);
}
else if (alreadyScan != null)
{
ScanDataModel newScan = new ScanDataModel()
{
DtScan = DateTime.Now,
UserScan = userScan,
ScanValue = lastScan,
IsForced = true,
CodArticolo = alreadyScan.CodArticolo,
Lotto = alreadyScan.Lotto,
RifExt = alreadyScan.RifExt,
Qty = alreadyScan.Qty,
Note = alreadyScan.Note,
IsKnown = alreadyScan.IsKnown,
IsUnique = alreadyScan.IsUnique,
InveSessID = sessID
};
await MIService.InsertNewScansione(newScan);
NavManager.NavigateTo(NavManager.Uri, true);
}
//}
//else
//{
// currLotto = null;
// currUdc = null;
// alreadyScan = null;
// NavManager.NavigateTo(NavManager.Uri, true);
//}
}
else
{
await JSRuntime.InvokeVoidAsync("alert", $"l'articolo {articoloScan} non risulta presente nelle nostre anagrafiche. Inserire un articolo giusto o controllare di non aver sbagliato a digitare");
await JSRuntime.InvokeVoidAsync("alert", $"Articolo errato: {articoloScan} non trovato in anagrafica");
}
}
+38 -3
View File
@@ -297,6 +297,39 @@ namespace MP.INVE.Data
return result;
}
public List<AnagLottiArca> ListLottiEsterni(string codArt, string codLotto, string codMagazzino)
{
string source = "";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
List<AnagLottiArca>? result = new List<AnagLottiArca>();
// cerco in redis...
RedisValue rawData = redisDb.StringGet(redisLottiEsterni);
if (!string.IsNullOrEmpty($"{rawData}"))
{
result = JsonConvert.DeserializeObject<List<AnagLottiArca>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbController.ListLottiEsterni(codArt, codLotto, codMagazzino);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSetAsync(redisLottiEsterni, rawData, getRandTOut(redisLongTimeCache));
source = "DB";
}
if (result == null)
{
result = new List<AnagLottiArca>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ListLottiEsterni Read from {source}: {ts.TotalMilliseconds}ms");
return result;
}
public List<ScanDataModel> ScanList()
{
string source = "";
@@ -413,7 +446,7 @@ namespace MP.INVE.Data
stopWatch.Start();
List<AnagLottoModel>? result = new List<AnagLottoModel>();
// cerco in redis...
RedisValue rawData = redisDb.StringGet(redisLottiBaseAddr);
RedisValue rawData = redisDb.StringGet(redisLottiInterni);
if (!string.IsNullOrEmpty($"{rawData}"))
{
result = JsonConvert.DeserializeObject<List<AnagLottoModel>>($"{rawData}");
@@ -425,7 +458,7 @@ namespace MP.INVE.Data
result = dbController.ElencoLotti();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSetAsync(redisLottiBaseAddr, rawData, getRandTOut(redisLongTimeCache));
redisDb.StringSetAsync(redisLottiInterni, rawData, getRandTOut(redisLongTimeCache));
source = "DB";
}
if (result == null)
@@ -599,8 +632,10 @@ namespace MP.INVE.Data
private const string redisBaseAddr = "MP:INVE";
private const string redisSessionBaseAddr = ":Session";
private const string redisOperatoriBaseAddr = ":Operatore";
private const string redisUdcBaseAddr = ":UDC";
private const string redisLottiBaseAddr = ":Lotti";
private const string redisUdcBaseAddr = ":UDC";
private const string redisLottiInterni = redisBaseAddr + redisLottiBaseAddr + ":LottiInterni";
private const string redisLottiEsterni = redisBaseAddr + redisLottiBaseAddr + ":LottiEsterni";
private const string redisConfigBaseAddr = ":Config";
private const string redisScanBaseAddr = redisBaseAddr + ":Scan";
private const string redisElencoOperatori = redisBaseAddr + redisOperatoriBaseAddr + ":ListOperatori";
+4
View File
@@ -21,6 +21,7 @@ namespace MP.INVE.Data
public string idOperatore { get; set; } = "";
public string authKey { get; set; } = "";
public int currIdSession { get; set; } = 0;
public int currIdMag { get; set; } = 0;
public bool reqNew { get; set; } = false;
#endregion Public Properties
@@ -52,6 +53,9 @@ namespace MP.INVE.Data
if (currIdSession != item.currIdSession)
return false;
if (currIdMag != item.currIdMag)
return false;
if (authKey != item.authKey)
return false;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>6.16.2212.713</Version>
<Version>6.16.2212.1218</Version>
</PropertyGroup>
<ItemGroup>
+8 -12
View File
@@ -1,37 +1,33 @@
@page "/Acquisizione"
<div class="mb-2">
<div class="d-flex justify-content-between">
<h3 class="fw-bold">Acquisizione</h3>
</div>
</div>
<div class="col-12">
<CodeScan lastRawScan="saveScan"></CodeScan>
</div>
<div class="card mb-5">
<div class="card-header">
<div class="card-header py-1">
<div class="col-12">
Last scan: <b>@rawScan</b>
</div>
</div>
<div class="card-body">
<div class="card-body py-0">
@*if (rawScan != null)
{
}*@
<div class="col-12">
<ProcSuggestion lastScan="@rawScan" sessID="@sessionId" userScan="@idOPeratore"></ProcSuggestion>
<ProcSuggestion lastScan="@rawScan" sessID="@sessionId" magID="@magazzinoId" userScan="@idOpr"></ProcSuggestion>
</div>
</div>
<div class="card-footer">
<div class="d-flex justify-content-between">
<div>
Sessione: <b>@sessionId</b>
S.<b>@sessionId</b> | @descr
</div>
<div>
Scansioni totali: <b>@nScansioniTot</b>
#:<b>@nScansioniTot</b>
</div>
<div>
@magInv
</div>
</div>
</div>
+21 -4
View File
@@ -35,27 +35,44 @@ namespace MP.INVE.Pages
private bool logged { get; set; } = false;
protected string rawScan { get; set; } = null!;
protected string idOPeratore { get; set; } = null!;
protected string idOpr { get; set; } = null!;
protected int sessionId { get; set; } = 0;
protected string magazzinoId { get; set; } = "";
protected int nScansioniTot { get; set; } = 0;
protected string descr { get; set; } = "";
protected string magInv { get; set; } = "";
protected List<ScanDataModel>? eleScansioni;
//protected AnagUdcModel currUdc{ get; set; } = null!;
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOperatore", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId))
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSess", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("codMag", out var _idMag))
{
idOPeratore = _matrOpr;
idOpr = _matrOpr;
sessionId = int.Parse(_inveSessionId);
magazzinoId = _idMag;
eleScansioni = MIService.ScanBySession(sessionId);
nScansioniTot = eleScansioni.Count();
// recupero dati della sessione di inventario...
var currSessions = MIService.InventSessCurrList();
var currInv = currSessions.Where(x=> x.InveSessID== sessionId).FirstOrDefault();
if (currInv != null)
{
descr = currInv.Description;
magInv = currInv.AnagMagNav.DescMag;
}
}
}
protected void saveScan(string newScan)
{
rawScan = newScan;
if (!string.IsNullOrEmpty(newScan))
{
rawScan = newScan;
}
}
}
}
+1 -146
View File
@@ -32,156 +32,11 @@
}
else
{
<InveSessionList currParams="@currParams" isLoading="@isLoading" ></InveSessionList>
@*@if (reqNew)
{
<div class="row">
<div class="col-12">
<div class="card mb-5">
<div class="card-header bg-primary text-light d-flex justify-content-between">
<div>
Avvia una nuova sessione
</div>
<div>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-4 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Magazzino</span>
<select class="form-select" @bind="@magazzino">
<option value="-1" selected>--Selezionare magazzino--</option>
@if (ElencoMagazzini != null)
{
@foreach (var item in ElencoMagazzini)
{
<option value="@item.MagID">@item.CodMag @item.CodCS | @item.DescMag</option>
}
}
</select>
</div>
</div>
<div class="col-8 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Descrizione</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind="@desc">
</div>
</div>
</div>
<div class="row pt-4" style="visibility:">
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button class="btn btn-warning" @onclick="closeNew">Annulla <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-3 pe-0">
@if (magazzino != -1)
{
<div class="d-grid gap-2">
<button class="btn btn-success" @onclick="insertNewSession">Save <i class="bi bi-save"></i></button>
</div>
}
</div>
</div>
</div>
</div>
</div>
</div>
}
<table class="table">
<thead>
<tr>
@if (inCorso)
{
<th scope="col">QR</th>
}
<th scope="col">ID sessione</th>
<th scope="col">Magazzino</th>
<th scope="col">Operatore</th>
<th scope="col">Data inizio</th>
<th scope="col">Data fine</th>
<th scope="col">Description</th>
<th scope="col">Trasferita</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@if (elencoSessioni != null)
{
@foreach (var item in elencoSessioni)
{
<tr>
@if (inCorso)
{
<td>
<!-- Button trigger modal -->
<button type="button" class="btn btn-dark" data-bs-toggle="modal" data-bs-target="#exampleModal" @onclick="()=> getCurrSess(item.InveSessID)" title="Apri qr per connettersi alla sessione">
<i class="fa-solid fa-qrcode"></i>
</button>
</td>
}
<td>
@item.InveSessID
</td>
<td>
@item.AnagMagNav.DescMag
</td>
<td>
@item.UserCrea
</td>
<td>
@item.DtStart
</td>
@if (item.DtEnd != null)
{
<td>
@item.DtEnd
</td>
}
else
{
<td>
In corso...
</td>
}
<td>
@item.Description
</td>
<td>
@if (item.Transferred)
{
<i class="fa-regular fa-square-check text-success"></i>
}
else
{
<i class="fa-regular fa-square text-dark"></i>
}
</td>
<td>
<button class="btn btn-danger btn-sm" @onclick="()=>deleteSession(item)">
<i class="fa-solid fa-trash-can"></i>
</button>
</td>
</tr>
}
}
</tbody>
</table>*@
<InveSessionList currParams="@currParams" isLoading="@isLoading" ></InveSessionList>
}
</div>
<div class="card-footer py-1">
@*<DataPager @ref="pagerSession" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="@isLoading" />*@
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="@isLoading" />
</div>
</div>
+10 -7
View File
@@ -12,9 +12,11 @@ namespace MP.INVE.Pages
{
#region Protected Properties
protected string authKey { get; set; } = null!;
protected string authKey { get; set; } = "";
protected string idOPeratore { get; set; } = null!;
protected string codMag { get; set; } = "";
protected string idOpr { get; set; } = "";
protected int inveSessionId { get; set; } = 0;
@@ -38,21 +40,22 @@ namespace MP.INVE.Pages
{
await Task.Delay(1);
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var _authKey) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId))
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var _authKey) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idMag", out var _codMag))
{
idOPeratore = _matrOpr;
idOpr = _matrOpr;
authKey = _authKey;
codMag = _codMag;
inveSessionId = int.Parse(_inveSessionId);
}
string pw = MIService.DeriptData(authKey);
logged = MIService.loginOperatore(int.Parse(idOPeratore), pw);
logged = MIService.loginOperatore(int.Parse(idOpr), pw);
if (logged)
{
operatore = MIService.ElencoOperatori();
if (operatore != null)
{
AnagOperatoriModel? currOpr = operatore.Where(x => (x.MatrOpr == int.Parse(idOPeratore)) && (x.authKey == pw)).SingleOrDefault();
AnagOperatoriModel? currOpr = operatore.Where(x => (x.MatrOpr == int.Parse(idOpr)) && (x.authKey == pw)).SingleOrDefault();
if (currOpr != null)
{
@@ -69,7 +72,7 @@ namespace MP.INVE.Pages
await localStorage.SetItemAsync("MatrOpr", currOpr);
await sessionStorage.SetItemAsync("idSessione", inveSessionId);
}
NavManager.NavigateTo($"Acquisizione?idSessione={inveSessionId}&idOperatore={idOPeratore}");
NavManager.NavigateTo($"Acquisizione?idSess={inveSessionId}&idOpr={idOpr}&codMag={codMag}");
}
}
}
-2
View File
@@ -32,9 +32,7 @@
<script src="lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="_framework/blazor.server.js" autostart="false"></script>
<script src="lib/chartBoot.js"></script>
<script src="lib/modalHandler.js"></script>
<script src="lib/Chart.js/chart.js"></script>
@*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@
<script>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2212.713</h4>
<h4>Versione: 6.16.2212.1218</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.713
6.16.2212.1218
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.713</version>
<version>6.16.2212.1218</version>
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1
View File
@@ -9,6 +9,7 @@
"CodApp": "MP.INVE",
"ConnectionStrings": {
"Mp.Inve": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;",
"Mp.IS": "Server=SQL2016DEV;Database=MoonPro_IS_EdilChim; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;",
"Mp.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;",
"Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
"RedisAdmin": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true"
+1 -1
View File
@@ -47,7 +47,7 @@ namespace MP.SPEC.Components
#region Private Fields
private static System.Timers.Timer aTimer = null!;
private System.Timers.Timer aTimer = null!;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private Version version = null!;
+74 -49
View File
@@ -3,12 +3,17 @@ using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.SPEC.Data;
using System.Diagnostics;
using MP.Data;
namespace MP.SPEC.Components
{
public partial class ListPARAMS : IDisposable
{
#region Public Fields
public SelectFluxParams? LastFilter = null;
#endregion Public Fields
#region Public Properties
[Parameter]
@@ -26,7 +31,7 @@ namespace MP.SPEC.Components
#endregion Public Properties
#region Public Methods
private SelectFluxParams lastFilter { get; set; } = new SelectFluxParams() { CurrPage = -1 };
public string checkSelect(FluxLog selRecord)
{
string answ = "";
@@ -42,24 +47,11 @@ namespace MP.SPEC.Components
return answ;
}
protected override async Task OnParametersSetAsync()
{
await Task.Delay(1);
// se sono cambiati --> rileggo...
if (!lastFilter.Equals(SelFilter))
{
lastFilter = SelFilter.clone();
await reloadData(true);
}
}
public SelectFluxParams? LastFilter = null;
public void Dispose()
{
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Close();
aTimer.Dispose();
currRecord = null;
SearchRecords = null;
@@ -69,30 +61,42 @@ namespace MP.SPEC.Components
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
{
if (!isLoading && LiveUpdate)
// controlo se URL diverso da apgina params...
if (!NavManager.Uri.Contains("PARAMS"))
{
aTimer.Stop();
// inizio misura esecuzione
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
var pUpd = Task.Run(async () =>
aTimer.Enabled = false;
}
else
{
aTimer.Enabled = true;
if (!isLoading && LiveUpdate)
{
await Task.Delay(1);
await InvokeAsync(() => reloadData(true));
});
pUpd.Wait();
// misuro tempo esecuzione
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
int deltaTime = RefreshPeriod - (int)ts.TotalMilliseconds;
aTimer.Interval = deltaTime > 100 ? deltaTime : 100;
aTimer.Start();
// inizio misura esecuzione
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
var pUpd = Task.Run(async () =>
{
await Task.Delay(1);
await InvokeAsync(() => reloadData(true));
});
pUpd.Wait();
// misuro tempo esecuzione
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
double deltaTime = RefreshPeriod - ts.TotalMilliseconds;
// aggiungo fattore di disturbo random...
double mFact = 0.01 * random.Next(80, 120);
aTimer.Interval = mFact * (deltaTime > 100 ? deltaTime : 100);
//aTimer.Start();
}
}
}
public async Task reloadData(bool setChanged)
{
isLoading = true;
SearchRecords = null;
ListRecords = null;
DateTime dataFrom = DateTime.Today.AddMonths(-1);
DateTime dataTo = DateTime.Now.AddMinutes(5);
if (SelFilter != null && SelFilter.dtMin != null)
@@ -104,7 +108,7 @@ namespace MP.SPEC.Components
dataTo = (DateTime)SelDtMax;
}
SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord, RefreshPeriod/1000);
SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord, RefreshPeriod / 1000);
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
@@ -120,11 +124,18 @@ namespace MP.SPEC.Components
aTimer = new System.Timers.Timer(RefreshPeriod);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
aTimer.AutoReset = true;
aTimer.Start();
}
#endregion Public Methods
#region Protected Fields
protected Random random = new Random();
#endregion Protected Fields
#region Protected Properties
[Inject]
@@ -147,8 +158,17 @@ namespace MP.SPEC.Components
StartTimer();
}
protected override async Task OnParametersSetAsync()
{
await Task.Delay(1);
// se sono cambiati --> rileggo...
if (!lastFilter.Equals(SelFilter))
{
lastFilter = SelFilter.clone();
await reloadData(true);
}
}
//protected int RefreshPeriod { get; set; } = 5000;
protected async void OnSeachUpdated()
{
await InvokeAsync(() =>
@@ -173,7 +193,6 @@ namespace MP.SPEC.Components
SelDtMax = selRec.dtEvento;
// imposto pag 1 filtro
SelFilter.CurrPage = 1;
//selDtMin = RoundDatetime(5).AddHours(-25);
await reloadData(false);
await RecordSel.InvokeAsync(selRec);
await PagerResetReq.InvokeAsync(true);
@@ -187,20 +206,14 @@ namespace MP.SPEC.Components
#endregion Protected Methods
private string traduci(string lemma)
{
var answ = MDService.Traduci(lemma, "IT");
return answ;
}
#region Private Fields
private static System.Timers.Timer aTimer = null!;
private int _totalCount = 0;
private System.Timers.Timer aTimer = null!;
private FluxLog? currRecord = null;
private List<FluxLog>? ListRecords;
private List<FluxLog>? SearchRecords;
#endregion Private Fields
@@ -215,6 +228,8 @@ namespace MP.SPEC.Components
private bool isLoading { get; set; } = false;
private SelectFluxParams lastFilter { get; set; } = new SelectFluxParams() { CurrPage = -1 };
private bool LiveUpdate
{
get => SelFilter.LiveUpdate;
@@ -225,12 +240,21 @@ namespace MP.SPEC.Components
get => SelFilter.MaxRecord;
}
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private int numRecord
{
get => SelFilter.NumRec;
set => SelFilter.NumRec = value;
}
private DateTime? SelDtMax
{
get => SelFilter.dtMax;
set => SelFilter.dtMax = value;
}
private string SelFlux
{
get => SelFilter.CodFlux;
@@ -240,11 +264,6 @@ namespace MP.SPEC.Components
{
get => SelFilter.IdxMacchina;
}
private DateTime? SelDtMax
{
get => SelFilter.dtMax;
set => SelFilter.dtMax = value;
}
private int totalCount
{
@@ -263,6 +282,12 @@ namespace MP.SPEC.Components
#region Private Methods
private string traduci(string lemma)
{
var answ = MDService.Traduci(lemma, "IT");
return answ;
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -176,7 +176,7 @@ namespace MP.SPEC.Components
await Task.Delay(1000);
// registro inizio produzione
idxEvento = 2;
idxEvento = 1;
evMess = $"Registrata inizio Produzione | PODL {selRec.IdxPromessa} | ODL {newOdl.IdxOdl} | ART {newOdl.CodArticolo}";
processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo);
+9 -1
View File
@@ -167,9 +167,17 @@ namespace MP.SPEC.Components
{
get => selMacchina != "*" || selFlux != "*";
}
protected int refreshRate = 2;
protected override async Task OnInitializedAsync()
{
SelFilter = new SelectFluxParams();
await MDService.ConfigResetCache();
var result = await MDService.tryGetConfig("SPEC_ParamTempoAgg");
if (result != null)
{
refreshRate = int.Parse(result);
}
selTempoAgg = refreshRate;
setDtSnap();
DateTime dtStart = SelFilter.dtMin != null ? (DateTime)SelFilter.dtMin : DateTime.Now.AddMonths(-1);
DateTime dtEnd = SelFilter.dtMax != null ? (DateTime)SelFilter.dtMax : DateTime.Today.AddDays(1);
@@ -259,7 +267,7 @@ namespace MP.SPEC.Components
#region Private Fields
private static System.Timers.Timer aTimer = new System.Timers.Timer();
private System.Timers.Timer aTimer = new System.Timers.Timer();
private List<string>? ListFlux = null;
private List<string>? ListMacchine = null;
private int numOreAnticipoSnapshot { get; set; } = 50;
+47 -2
View File
@@ -575,6 +575,37 @@ namespace MP.SPEC.Data
return await dbController.EvListInsert(newRec);
}
/// <summary>
/// Imposta in redis la scadenza della pagina x il reload
/// </summary>
/// <param name="expTime"></param>
/// <returns></returns>
public DateTime ExpiryReloadParamGet()
{
DateTime dtRif = DateTime.Now;
string currKey = $"{redisParamPageExp}";
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
dtRif = JsonConvert.DeserializeObject<DateTime>($"{rawData}");
}
return dtRif;
}
/// <summary>
/// Imposta in redis la scadenza della pagina x il reload
/// </summary>
/// <param name="expTime"></param>
/// <returns></returns>
public bool ExpiryReloadParamSet(DateTime expTime)
{
bool fatto = false;
string currKey = $"{redisParamPageExp}";
string rawData = JsonConvert.SerializeObject(expTime);
fatto = redisDb.StringSet(currKey, rawData);
return fatto;
}
public async Task<bool> FlushRedisCache()
{
await Task.Delay(1);
@@ -594,7 +625,7 @@ namespace MP.SPEC.Data
/// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param>
/// <param name="MaxRec">numero massimo record da restituire</param>
/// <returns></returns>
public async Task<List<FluxLog>> FluxLogGetLastFilt(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec, int redisCacheSec)
public async Task<List<FluxLog>> FluxLogGetLastFilt(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec, double redisCacheSec)
{
List<FluxLog>? result = new List<FluxLog>();
Stopwatch stopWatch = new Stopwatch();
@@ -613,7 +644,14 @@ namespace MP.SPEC.Data
result = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, DtMin, IdxMacchina, CodFlux, MaxRec));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec / 2));
if (string.IsNullOrEmpty(canCacheParametri))
{
canCacheParametri = await tryGetConfig("SPEC_ParametriEnableRedisCache");
}
if (canCacheParametri != "false")
{
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec));
}
}
if (result == null)
{
@@ -1373,6 +1411,12 @@ namespace MP.SPEC.Data
#endregion Protected Fields
#region Protected Properties
protected string canCacheParametri { get; set; } = "";
#endregion Protected Properties
#region Protected Methods
/// <summary>
@@ -1416,6 +1460,7 @@ namespace MP.SPEC.Data
private const string redisOdlByBatch = redisXdlData + "OdlByBatch";
private const string redisOdlCurrByMac = redisXdlData + "OdlByMac";
private const string redisOdlList = redisXdlData + "OdlList";
private const string redisParamPageExp = redisBaseAddrSpec + "Cache:ParamPage";
private const string redisPOdlByOdl = redisXdlData + "POdlByOdl";
private const string redisPOdlByPOdl = redisXdlData + "POdlByPOdl";
private const string redisPOdlList = redisXdlData + "POdlList";
+5 -3
View File
@@ -17,21 +17,22 @@
public string CodFlux { get; set; } = "*";
public int CurrPage { get; set; } = 1;
public DateTime? dtRif { get; set; } = null;
public DateTime? dtMax { get; set; } = null;
public DateTime? dtMin { get; set; } = null;
public DateTime? dtRif { get; set; } = null;
public DateTime? dtSnapMin { get; set; } = null;
public string IdxMacchina { get; set; } = "*";
public string lastUpdate { get; set; } = "-";
public bool LiveUpdate { get; set; } = true;
public int NumRec { get; set; } = 10;
public int MaxRecord { get; set; } = 100;
public int TempoAgg { get; set; } = 10000;
public int NumRec { get; set; } = 10;
public int TempoAgg { get; set; } = 2000;
public int TotCount { get; set; } = 0;
#endregion Public Properties
#region Public Methods
public SelectFluxParams clone()
{
SelectFluxParams clonedData = new SelectFluxParams()
@@ -52,6 +53,7 @@
};
return clonedData;
}
public override bool Equals(object obj)
{
if (!(obj is SelectFluxParams item))
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2212.919</Version>
<Version>6.16.2212.1220</Version>
</PropertyGroup>
<ItemGroup>
+120 -25
View File
@@ -2,29 +2,122 @@
using MP.Data.DatabaseModels;
using MP.SPEC.Components;
using MP.SPEC.Data;
using NLog;
namespace MP.SPEC.Pages
{
public partial class PARAMS
public partial class PARAMS : IDisposable
{
#region Public Methods
public void Dispose()
{
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Close();
aTimer.Dispose();
GC.Collect();
}
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
{
// controllo se sia scaduto tempo massimo (in redis) x ricaricare pagina in modo completo...
var dtRif = MDService.ExpiryReloadParamGet();
if (dtRif > DateTime.Now)
{
Log.Trace("----- Elapsed check PARAMS.cs -----");
}
else
{
var pUpd = Task.Run(async () =>
{
MDService.ExpiryReloadParamSet(DateTime.Now.AddSeconds(intForceReload));
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Close();
aTimer.Dispose();
await Task.Delay(1);
await InvokeAsync(() => forceReloadCache());
});
pUpd.Wait();
}
}
public void StartTimer()
{
Random random = new Random();
double multPer = 0.01 * random.Next(50, 300);
aTimer = new System.Timers.Timer(RefreshPeriod * multPer);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
aTimer.AutoReset = true;
aTimer.Start();
}
#endregion Public Methods
#region Protected Fields
protected int CurrCounter = 0;
protected int intForceReload = 600;
protected DataPager? pagerODL = null!;
#endregion Protected Fields
#region Protected Properties
[Inject]
protected MpDataService MDService { get; set; } = null!;
protected int RefreshPeriod
{
get => currFilter.TempoAgg;
}
#endregion Protected Properties
#region Protected Methods
protected async Task detailSel(FluxLog newRec)
{
await Task.Delay(1);
var updFilter = currFilter;
DateTime adesso = DateTime.Now.AddSeconds(1);
updFilter.LiveUpdate = (newRec == null);
// sistemo la data di riferimento x eventuale snapshot nel passato
updFilter.dtRif = newRec != null ? newRec.dtEvento : null;
if (newRec != null)
{
updFilter.lastUpdate = updFilter.lastUpdate == "-" ? $"{adesso:yyyy/MM/dd HH:mm:ss}" : updFilter.lastUpdate;
updFilter.IdxMacchina = newRec.IdxMacchina;
//updFilter.CodFlux = newRec.CodFlux;
}
else
{
updFilter.lastUpdate = "-";
}
// salvo filtro
currFilter = updFilter;
}
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
/// <summary>
/// Esegue svuotamento forzato cache + reload pagina ogni minuto...
/// </summary>
protected async Task forceReloadCache()
{
Log.Debug("----- forceReloadCache on PARAMS.cs -----");
await Task.Delay(1);
await MDService.FlushRedisCache();
await Task.Delay(1);
// rimando a pagina corrente
NavManager.NavigateTo(NavManager.Uri, true, true);
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
@@ -49,6 +142,8 @@ namespace MP.SPEC.Pages
modFilter.LiveUpdate = (currPage == 1);
currFilter = modFilter;
await Task.Delay(1);
setExpiryReload();
StartTimer();
isFiltering = false;
}
@@ -69,31 +164,20 @@ namespace MP.SPEC.Pages
totalCount = newTotCount;
}
protected async Task detailSel(FluxLog newRec)
protected void UpdateTotCount(int newTotCount)
{
await Task.Delay(1);
var updFilter = currFilter;
DateTime adesso = DateTime.Now.AddSeconds(1);
updFilter.LiveUpdate = (newRec == null);
// sistemo la data di riferimento x eventuale snapshot nel passato
updFilter.dtRif = newRec != null ? newRec.dtEvento : null;
if (newRec != null)
{
updFilter.lastUpdate = updFilter.lastUpdate == "-" ? $"{adesso:yyyy/MM/dd HH:mm:ss}" : updFilter.lastUpdate;
updFilter.IdxMacchina = newRec.IdxMacchina;
//updFilter.CodFlux = newRec.CodFlux;
}
else
{
updFilter.lastUpdate = "-";
}
// salvo filtro
currFilter = updFilter;
totalCount = newTotCount;
}
#endregion Protected Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private System.Timers.Timer aTimer = null!;
#endregion Private Fields
#region Private Properties
private SelectFluxParams currFilter { get; set; } = new SelectFluxParams();
@@ -105,8 +189,12 @@ namespace MP.SPEC.Pages
}
private bool isFiltering { get; set; } = false;
private bool isLoading { get; set; } = true;
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private int numRecord
{
get => currFilter.NumRec;
@@ -119,6 +207,16 @@ namespace MP.SPEC.Pages
#region Private Methods
private void setExpiryReload()
{
// verifico se ho una scadenza expiry del periodo desiderato, sennò imposto nuova...
var dtRif = MDService.ExpiryReloadParamGet();
if (dtRif <= DateTime.Now)
{
MDService.ExpiryReloadParamSet(DateTime.Now.AddSeconds(intForceReload));
}
}
private async Task updateFilter(SelectFluxParams newParams)
{
isFiltering = false;
@@ -139,10 +237,7 @@ namespace MP.SPEC.Pages
currFilter = newParams;
isLoading = false;
}
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
}
#endregion Private Methods
}
}
+1
View File
@@ -39,6 +39,7 @@ namespace MP.SPEC.Pages
CurrAction.Topic = "Chiusura ODL";
CurrAction.Message = "Rilevato possibile fine operazioni, Vuoi chiudere la commessa?";
MMDataService.ActionSetReq(CurrAction);
await Task.Delay(1);
}
protected override async Task OnInitializedAsync()
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2212.919</h4>
<h4>Versione: 6.16.2212.1220</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.919
6.16.2212.1220
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.919</version>
<version>6.16.2212.1220</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>