TAB3:
- filtro operatore su impianti visualizzati
This commit is contained in:
@@ -93,6 +93,7 @@ namespace MP_TAB3.Components
|
||||
await MsgServ.ClearLocalStor();
|
||||
await MsgServ.ClearSessionStor();
|
||||
await MDataService.FlushCache();
|
||||
await TDService.FlushCache();
|
||||
// salvo di nuovo opr + GUID
|
||||
await MsgServ.SetCurrDevGuidLSAsync(devGuid);
|
||||
await MsgServ.SetLastMatrOprAsync(lastOpr);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2404.3016</Version>
|
||||
<Version>6.16.2405.810</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -118,13 +118,34 @@ namespace MP_TAB3.Pages
|
||||
Width = dimension.Width;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se la macchina sia abilitata per l'operatore
|
||||
/// </summary>
|
||||
/// <param name="idxMacc"></param>
|
||||
/// <returns></returns>
|
||||
protected bool MachineIsOprEnab(string idxMacc)
|
||||
{
|
||||
bool answ = false;
|
||||
if (ListMachineEnabled != null && !string.IsNullOrEmpty(idxMacc))
|
||||
{
|
||||
var macRec = ListMachineEnabled
|
||||
.Where(x => x.IdxMacchina == idxMacc)
|
||||
.FirstOrDefault();
|
||||
answ = macRec != null && macRec.IdxMacchina == idxMacc;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await getWDim();
|
||||
isCalcSize = false;
|
||||
ListMSE = await MDataService.MseGetAll(true);
|
||||
|
||||
//ListMSE = await MDataService.MseGetAll(true);
|
||||
AllDataMSE = await MDataService.MseGetAll(true);
|
||||
FiltOprMse();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
if (ListMSE != null)
|
||||
@@ -136,6 +157,7 @@ namespace MP_TAB3.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// ora resetto il resto
|
||||
ListMSE = null;
|
||||
setDefaults();
|
||||
TDFeeder.dataPipe.EA_NewMessage += DataPipe_EA_NewMessage;
|
||||
@@ -155,9 +177,21 @@ namespace MP_TAB3.Pages
|
||||
}
|
||||
}
|
||||
|
||||
protected void SaveData(List<MappaStatoExpl> newList)
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
ListMSE = newList;
|
||||
// x prima cosa elenco macchine operatore...
|
||||
ListMachineEnabled = await TabDServ.MacchineByMatrOper(MatrOpr);
|
||||
}
|
||||
|
||||
protected async Task SaveData(List<MappaStatoExpl> newList)
|
||||
{
|
||||
// rileggo elenco macchine operatore...
|
||||
ListMachineEnabled = await TabDServ.MacchineByMatrOper(MatrOpr);
|
||||
// salvo valori ricevuti
|
||||
//ListMSE = newList;
|
||||
AllDataMSE = newList;
|
||||
// filtro!
|
||||
FiltOprMse();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
@@ -165,16 +199,26 @@ namespace MP_TAB3.Pages
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private bool doBlink = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<MappaStatoExpl>? AllDataMSE { get; set; } = null;
|
||||
|
||||
private string baseLang { get; set; } = "";
|
||||
|
||||
private List<Macchine>? ListMachineEnabled { get; set; } = null;
|
||||
|
||||
private List<MappaStatoExpl>? ListMSE { get; set; } = null;
|
||||
|
||||
private int MatrOpr
|
||||
{
|
||||
get => MsgServ.MatrOpr;
|
||||
}
|
||||
|
||||
private string tcMode { get; set; } = "";
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -238,6 +282,25 @@ namespace MP_TAB3.Pages
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filtro dati operatore tra macchine visualizzabili e elenco MSE ricevuto
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void FiltOprMse()
|
||||
{
|
||||
ListMSE = new List<MappaStatoExpl>();
|
||||
if (AllDataMSE != null)
|
||||
{
|
||||
foreach (var item in AllDataMSE)
|
||||
{
|
||||
if (MachineIsOprEnab(item.IdxMacchina))
|
||||
{
|
||||
ListMSE.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setDefaults()
|
||||
{
|
||||
string df = MsgServ.UserPrefSetup("DefCardMode", "full");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2404.3016</h4>
|
||||
<h4>Versione: 6.16.2405.810</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2404.3016
|
||||
6.16.2405.810
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2404.3016</version>
|
||||
<version>6.16.2405.810</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -711,6 +711,56 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Macchine dato operatore secondo gruppi (macchine/operatore)
|
||||
/// </summary>
|
||||
/// <param name="MatrOpr"></param>
|
||||
/// <returns></returns>
|
||||
public List<Macchine> MacchineByMatrOper(int MatrOpr)
|
||||
{
|
||||
List<Macchine> dbResult = new List<Macchine>();
|
||||
try
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
if (MatrOpr == 0)
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMacchine
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetGrp2Oper
|
||||
.Where(g => g.MatrOpr == MatrOpr)
|
||||
.Join(dbCtx.DbSetGrp2Macc,
|
||||
g => g.CodGruppo,
|
||||
m => m.CodGruppo,
|
||||
(g, m) => m
|
||||
)
|
||||
.Distinct()
|
||||
.Join(dbCtx.DbSetMacchine,
|
||||
g => g.IdxMacchina,
|
||||
m => m.IdxMacchina,
|
||||
(g, m) => m
|
||||
)
|
||||
.Distinct()
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in MacchineByMatrOper{Environment.NewLine}{exc}");
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MicroStato macchina (da key)
|
||||
/// </summary>
|
||||
@@ -1625,30 +1675,6 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiorna un record scarti KIT ( SE ESISTE...)
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public bool RegScartiKitUpdateQty(RegistroScartiKitModel currRec)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacc = new SqlParameter("@IdxMacchina", currRec.IdxMacchina);
|
||||
var DtRif = new SqlParameter("@DataOra", currRec.DataOra);
|
||||
var Causale = new SqlParameter("@Causale", currRec.Causale);
|
||||
var CodArticolo = new SqlParameter("@CodArticolo", currRec.CodArticolo);
|
||||
var Qty = new SqlParameter("@Qty", currRec.Qta);
|
||||
|
||||
var dbResult = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC stp_RSK_UpdateQty @IdxMacchina, @DataOra, @Causale, @CodArticolo, @Qty", IdxMacc, DtRif, Causale, CodArticolo, Qty);
|
||||
|
||||
answ = dbResult != 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco scarti KIT dato record parent
|
||||
@@ -1701,6 +1727,31 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna un record scarti KIT ( SE ESISTE...)
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public bool RegScartiKitUpdateQty(RegistroScartiKitModel currRec)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacc = new SqlParameter("@IdxMacchina", currRec.IdxMacchina);
|
||||
var DtRif = new SqlParameter("@DataOra", currRec.DataOra);
|
||||
var Causale = new SqlParameter("@Causale", currRec.Causale);
|
||||
var CodArticolo = new SqlParameter("@CodArticolo", currRec.CodArticolo);
|
||||
var Qty = new SqlParameter("@Qty", currRec.Qta);
|
||||
|
||||
var dbResult = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC stp_RSK_UpdateQty @IdxMacchina, @DataOra, @Causale, @CodArticolo, @Qty", IdxMacc, DtRif, Causale, CodArticolo, Qty);
|
||||
|
||||
answ = dbResult != 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua ricalcolo MSE x macchina indicata
|
||||
/// </summary>
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace MP.Data.Services
|
||||
|
||||
public TabDataFeeder(IConfiguration configuration) : base(configuration)
|
||||
{
|
||||
|
||||
// setup canali pub/sub
|
||||
dataPipe = new MessagePipe(redisConn, Constants.TAB_ACT_MSE_DATA_KEY, false);
|
||||
blinkPipe = new MessagePipe(redisConn, Constants.TAB_ACT_BLINK_KEY, false);
|
||||
@@ -77,10 +76,8 @@ namespace MP.Data.Services
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
|
||||
private int fastRefreshMs = 1000;
|
||||
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
@@ -22,25 +22,6 @@ namespace MP.Data.Services
|
||||
{
|
||||
public class TabDataService : BaseServ, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Evento richiesta rilettura dati pagina (x refresh pagine aperte)
|
||||
/// </summary>
|
||||
public event EventHandler ReloadRequest = delegate { };
|
||||
|
||||
/// <summary>
|
||||
/// Invio notifica rilettura (con parametro)
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public void NotifyReloadRequest(string message)
|
||||
{
|
||||
if (ReloadRequest != null)
|
||||
{
|
||||
// messaggio
|
||||
ReloadEventArgs rea = new ReloadEventArgs(message);
|
||||
ReloadRequest.Invoke(this, rea);
|
||||
}
|
||||
}
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
@@ -95,6 +76,15 @@ namespace MP.Data.Services
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Events
|
||||
|
||||
/// <summary>
|
||||
/// Evento richiesta rilettura dati pagina (x refresh pagine aperte)
|
||||
/// </summary>
|
||||
public event EventHandler ReloadRequest = delegate { };
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
@@ -877,7 +867,21 @@ namespace MP.Data.Services
|
||||
await FlushCache("PODL");
|
||||
await FlushCache("VSODL");
|
||||
await FlushCache("StatoMacc");
|
||||
await FlushCache("MSFD");
|
||||
await FlushCache("MSFD");
|
||||
}
|
||||
|
||||
public TimeSpan GetKeyTTL(string redKey)
|
||||
{
|
||||
TimeSpan answ = TimeSpan.FromMinutes(-1);
|
||||
try
|
||||
{
|
||||
answ = redisDb.KeyTimeToLive(redKey) ?? new TimeSpan();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Info($"Errore GetKeyTTL | currKey: {redKey}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1035,6 +1039,43 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Macchine dato operatore secondo gruppi (macchine/operatore)
|
||||
/// </summary>
|
||||
/// <param name="MatrOpr"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<Macchine>> MacchineByMatrOper(int MatrOpr)
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<Macchine> result = new List<Macchine>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:MachByMatOp:{MatrOpr}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
//if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<Macchine>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.MacchineByMatrOper(MatrOpr);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<Macchine>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"MacchineByMatrOper | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista parametri correnti (ObjItemDTO) della macchina
|
||||
/// </summary>
|
||||
@@ -1221,6 +1262,20 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invio notifica rilettura (con parametro)
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public void NotifyReloadRequest(string message)
|
||||
{
|
||||
if (ReloadRequest != null)
|
||||
{
|
||||
// messaggio
|
||||
ReloadEventArgs rea = new ReloadEventArgs(message);
|
||||
ReloadRequest.Invoke(this, rea);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ODL da key
|
||||
/// </summary>
|
||||
@@ -1649,21 +1704,6 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
public TimeSpan GetKeyTTL(string redKey)
|
||||
{
|
||||
TimeSpan answ = TimeSpan.FromMinutes(-1);
|
||||
try
|
||||
{
|
||||
answ = redisDb.KeyTimeToLive(redKey) ?? new TimeSpan();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Info($"Errore GetKeyTTL | currKey: {redKey}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Legge l'oggetto operatore+device loggato e restituisce la sua TTL
|
||||
/// </summary>
|
||||
@@ -3223,16 +3263,11 @@ namespace MP.Data.Services
|
||||
|
||||
private string CodModulo = "";
|
||||
private string CodModuloParam = "";
|
||||
private string MpIoNS = "";
|
||||
|
||||
private string ConnStr = "";
|
||||
|
||||
private Dictionary<string, string> connStrParams = new Dictionary<string, string>();
|
||||
|
||||
private string DataBase = "";
|
||||
|
||||
private string DataSource = "";
|
||||
|
||||
private string MpIoNS = "";
|
||||
private string redisBaseKey = "MP:TAB:Cache";
|
||||
private string redisUserDataKey = "MP:TAB:Users";
|
||||
|
||||
@@ -3324,20 +3359,6 @@ namespace MP.Data.Services
|
||||
|
||||
return result;
|
||||
}
|
||||
private string redHashParam(string keyName)
|
||||
{
|
||||
string result = keyName;
|
||||
try
|
||||
{
|
||||
result = $"{CodModuloParam}:{DataSource}:{DataBase}:{keyName}".Replace("\\", "_");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in redHashParam{Environment.NewLine}{exc}");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private string redHashMpIO(string keyName)
|
||||
{
|
||||
@@ -3354,7 +3375,20 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
private string redHashParam(string keyName)
|
||||
{
|
||||
string result = keyName;
|
||||
try
|
||||
{
|
||||
result = $"{CodModuloParam}:{DataSource}:{DataBase}:{keyName}".Replace("\\", "_");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in redHashParam{Environment.NewLine}{exc}");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero HashSet redis come Dictionary
|
||||
@@ -3469,5 +3503,4 @@ namespace MP.Data.Services
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user