Update x evitare derive memoria

This commit is contained in:
Samuele Locatelli
2025-07-23 19:52:58 +02:00
parent 789dce59fe
commit 6ff1da7c66
5 changed files with 144 additions and 113 deletions
+48 -42
View File
@@ -6,7 +6,7 @@ using static EgwCoreLib.Utils.DtUtils;
namespace MP_TAB3.Components
{
public partial class ControlsMan
public partial class ControlsMan : IDisposable
{
#region Public Properties
@@ -23,6 +23,12 @@ namespace MP_TAB3.Components
#region Public Methods
public void Dispose()
{
ListComplete.Clear();
ListPaged.Clear();
}
/// <summary>
/// Aggiorno valori produzione alla data richiesta...
/// </summary>
@@ -78,8 +84,6 @@ namespace MP_TAB3.Components
#endregion Protected Properties
private bool isMulti = false;
#region Protected Methods
/// <summary>
@@ -125,44 +129,7 @@ namespace MP_TAB3.Components
await doUpdate();
}
}
/// <summary>
/// Macchina selezionata MAIN
/// </summary>
private string IdxMaccMain
{
get => RecMSE != null ? RecMSE.IdxMacchina : "";
}
/// <summary>
/// Restituisce il codice IdxMacchina dell'altra tavola (se multi) altrimenti la stessa macchina...
/// </summary>
private string idxMaccAltraTav
{
get
{
string answ = "";
if (RecMSE != null)
{
try
{
// verifico se SIA una tavola (ha char "#")
int iSharp = IdxMaccMain.IndexOf('#');
if (iSharp > 0)
{
// ora verifico SE ALTRA TAVOLA ha ODL...
string nomeTav = IdxMaccMain.Substring(iSharp);
string altraTav = nomeTav.Substring(0, nomeTav.Length - 1);
altraTav += nomeTav.EndsWith("1") ? "2" : "1";
// sistemo nome
answ = IdxMaccMain.Replace(nomeTav, altraTav);
}
}
catch
{ }
}
return answ;
}
}
protected async Task SaveKo()
{
isProcessing = true;
@@ -279,7 +246,7 @@ namespace MP_TAB3.Components
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private bool isMulti = false;
private bool isProcessing = false;
private string noteKo = "";
@@ -302,9 +269,48 @@ namespace MP_TAB3.Components
private Periodo CurrPeriodo { get; set; } = new Periodo();
private string IdxMaccSel { get; set; } = "";
private string IdxMaccAltra { get; set; } = "";
/// <summary>
/// Restituisce il codice IdxMacchina dell'altra tavola (se multi) altrimenti la stessa macchina...
/// </summary>
private string idxMaccAltraTav
{
get
{
string answ = "";
if (RecMSE != null)
{
try
{
// verifico se SIA una tavola (ha char "#")
int iSharp = IdxMaccMain.IndexOf('#');
if (iSharp > 0)
{
// ora verifico SE ALTRA TAVOLA ha ODL...
string nomeTav = IdxMaccMain.Substring(iSharp);
string altraTav = nomeTav.Substring(0, nomeTav.Length - 1);
altraTav += nomeTav.EndsWith("1") ? "2" : "1";
// sistemo nome
answ = IdxMaccMain.Replace(nomeTav, altraTav);
}
}
catch
{ }
}
return answ;
}
}
/// <summary>
/// Macchina selezionata MAIN
/// </summary>
private string IdxMaccMain
{
get => RecMSE != null ? RecMSE.IdxMacchina : "";
}
private string IdxMaccSel { get; set; } = "";
private int IdxOdl { get; set; } = 0;
private string selMessage
+4
View File
@@ -70,6 +70,10 @@ namespace MP_TAB3.Components
public void Dispose()
{
innerCircleVals.Clear();
outerCircleVals.Clear();
datiProdAct = null;
LastRecMSE = null;
TabDServ.DataInvalidated -= TabDServ_DataInvalidated;
}
+40 -27
View File
@@ -6,7 +6,7 @@ using static EgwCoreLib.Utils.DtUtils;
namespace MP_TAB3.Components
{
public partial class ProdConfMan
public partial class ProdConfMan : IDisposable
{
#region Public Properties
@@ -19,14 +19,27 @@ namespace MP_TAB3.Components
[Parameter]
public string IdxMacchSub { get; set; } = "";
[Parameter]
public bool ShowRilav { get; set; } = false;
[Parameter]
public MappaStatoExplModel? RecMSE { get; set; } = null;
[Parameter]
public bool ShowRilav { get; set; } = false;
#endregion Public Properties
#region Public Methods
public void Dispose()
{
ListComplete.Clear();
ListPaged.Clear();
ListaOdl.Clear();
ListaOper.Clear();
DictOpr.Clear();
}
#endregion Public Methods
#region Protected Properties
protected List<ElencoConfermeProdModel> ListComplete { get; set; } = new List<ElencoConfermeProdModel>();
@@ -67,13 +80,6 @@ namespace MP_TAB3.Components
}
}
private void setupPeriodo()
{
DateTime fine = DateTime.Today.AddDays(1);
DateTime inizio = fine.AddDays(-7);
CurrPeriodo = new Periodo(inizio, fine);
}
protected async Task SetMacc(string selIdxMacc)
{
isProcessing = true;
@@ -242,6 +248,22 @@ namespace MP_TAB3.Components
#region Private Methods
private ODLModel ActiveOdl(DateTime dtRif)
{
var recOdl = ListaOdl
.Where(x => x.DataInizio <= dtRif && (x.DataFine >= dtRif || x.DataFine == null))
.FirstOrDefault();
return recOdl ?? new ODLModel();
}
private ODLModel GetOdl(int idxOdl)
{
var recOdl = ListaOdl
.Where(x => x.IdxOdl == idxOdl)
.FirstOrDefault();
return recOdl ?? new ODLModel();
}
private MarkupString OperDto(int matr)
{
string answ = $"[{matr}]";
@@ -263,22 +285,6 @@ namespace MP_TAB3.Components
return (MarkupString)answ;
}
private ODLModel ActiveOdl(DateTime dtRif)
{
var recOdl = ListaOdl
.Where(x => x.DataInizio <= dtRif && (x.DataFine >= dtRif || x.DataFine == null))
.FirstOrDefault();
return recOdl ?? new ODLModel();
}
private ODLModel GetOdl(int idxOdl)
{
var recOdl = ListaOdl
.Where(x => x.IdxOdl == idxOdl)
.FirstOrDefault();
return recOdl ?? new ODLModel();
}
/// <summary>
/// Rileggo anagrafiche di base
/// </summary>
@@ -307,6 +313,13 @@ namespace MP_TAB3.Components
isProcessing = false;
}
private void setupPeriodo()
{
DateTime fine = DateTime.Today.AddDays(1);
DateTime inizio = fine.AddDays(-7);
CurrPeriodo = new Periodo(inizio, fine);
}
#endregion Private Methods
}
}
+44 -36
View File
@@ -6,14 +6,8 @@ using NLog.Fluent;
namespace MP_TAB3.Components
{
public partial class ProdConfirm:IDisposable
public partial class ProdConfirm : IDisposable
{
public void Dispose()
{
confTimer.Elapsed -= ConfTimer_Elapsed;
}
#region Public Properties
/// <summary>
@@ -53,6 +47,16 @@ namespace MP_TAB3.Components
#endregion Public Properties
#region Public Methods
public void Dispose()
{
datiProdAct = null;
confTimer.Elapsed -= ConfTimer_Elapsed;
}
#endregion Public Methods
#region Protected Properties
protected string ConfBg
@@ -249,22 +253,6 @@ namespace MP_TAB3.Components
confTimer.Elapsed += ConfTimer_Elapsed;
}
/// <summary>
/// Timer visualizzazione esito conferma pezzi: deve nascondere...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <exception cref="NotImplementedException"></exception>
private void ConfTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
{
confTimer.Stop();
showConfirmResult = false;
// resetto
lastPzBuoni = 0;
lastPzRilav = 0;
lastPzScarto = 0;
}
protected override async Task OnParametersSetAsync()
{
lblOut = "";
@@ -340,11 +328,6 @@ namespace MP_TAB3.Components
confTimer.Start();
}
/// <summary>
/// Timer 3 sec x mostrare conferma
/// </summary>
private System.Timers.Timer confTimer = new System.Timers.Timer(3000);
protected void setConfirmBtn(bool newVal)
{
showConfirm = newVal;
@@ -385,20 +368,37 @@ namespace MP_TAB3.Components
private bool chkPzBuoniNeg = false;
private bool confDone = false;
private bool confRett = false;
/// <summary>
/// Timer 3 sec x mostrare conferma
/// </summary>
private System.Timers.Timer confTimer = new System.Timers.Timer(3000);
private bool enableMagPrint = false;
private bool enablePzProdLasciati = false;
private bool confDone = false;
private bool isMulti = false;
private bool isSlave = false;
private DateTime lastConfProd = DateTime.Now;
private int lastPzBuoni = 0;
private int lastPzRilav = 0;
private int lastPzScarto = 0;
private string lblOut = "";
private int modoConfProd = 0;
private bool showConfirmResult = false;
#endregion Private Fields
#region Private Properties
@@ -424,17 +424,25 @@ namespace MP_TAB3.Components
private bool showConfirm { get; set; } = true;
private bool showConfirmResult = false;
private int lastPzBuoni = 0;
private int lastPzRilav = 0;
private int lastPzScarto = 0;
private DateTime lastConfProd = DateTime.Now;
#endregion Private Properties
#region Private Methods
/// <summary>
/// Timer visualizzazione esito conferma pezzi: deve nascondere...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ConfTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
{
confTimer.Stop();
showConfirmResult = false;
// resetto
lastPzBuoni = 0;
lastPzRilav = 0;
lastPzScarto = 0;
}
/// <summary>
/// Registra conferma produzione in modalita nuova (con rettifica pezzi lasciati) o legacy
/// (con anticipo periodo)
+8 -8
View File
@@ -2,14 +2,6 @@ namespace MP_TAB3.Pages
{
public partial class Controls
{
#region Private Fields
private string IdxMaccSubSel = "";
private bool IsLoading = false;
#endregion Private Fields
#region Protected Methods
protected async Task ForceReload()
@@ -31,5 +23,13 @@ namespace MP_TAB3.Pages
}
#endregion Protected Methods
#region Private Fields
private string IdxMaccSubSel = "";
private bool IsLoading = false;
#endregion Private Fields
}
}