completata revisione counters
This commit is contained in:
@@ -4117,6 +4117,49 @@ namespace MTC_Adapter
|
||||
|
||||
#region metodi che prevedono salvataggio valori su file XML/BIN
|
||||
|
||||
/// <summary>
|
||||
/// Processing delle variabili generiche Counters
|
||||
/// </summary>
|
||||
/// <param name="needSave"></param>
|
||||
/// <returns></returns>
|
||||
public bool procCounters(bool needSave)
|
||||
{
|
||||
uint delta = 0;
|
||||
uint valore = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < mCounters.Length; i++)
|
||||
{
|
||||
// procedo solo SE HO FINESTRA VALIDA...
|
||||
if (istCounters[i].vcValid)
|
||||
{
|
||||
valore = Convert.ToUInt32(istCounters[i].vcMedian);
|
||||
if (valore >= currCounters[i])
|
||||
{
|
||||
delta = valore - currCounters[i];
|
||||
// controllo delta < 50% max...
|
||||
if (delta < uint.MaxValue / 2)
|
||||
{
|
||||
//processo comunque sempre...
|
||||
uint contTot = updateValUIntByIncr(i, delta, "Counter_{0:000}");
|
||||
// passo valore totale all'adapter
|
||||
mCounters[i].Value = contTot;
|
||||
// controllo valore riferimento...
|
||||
if (delta > 0)
|
||||
{
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ...aggiorno valore riferimento...
|
||||
currCounters[i] = valore;
|
||||
}
|
||||
sb.AppendLine(mCounters[i].ToString().Replace("|", " | "));
|
||||
}
|
||||
// salvo su maschera...
|
||||
parentForm.dataMonitor_2 += sb.ToString();
|
||||
return needSave;
|
||||
}
|
||||
/// <summary>
|
||||
/// Processing delle ore macchina ACCESA
|
||||
/// </summary>
|
||||
@@ -4124,32 +4167,37 @@ namespace MTC_Adapter
|
||||
/// <returns></returns>
|
||||
public bool procOreMaccOn(bool needSave)
|
||||
{
|
||||
double delta = 0;
|
||||
double valore = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (istOreMaccOn.vcValid)
|
||||
{
|
||||
double delta = istOreMaccOn.vcMedian - contOreMaccOn;
|
||||
// controllo delta < 50% max...
|
||||
if (delta < double.MaxValue / 2)
|
||||
valore = istOreMaccOn.vcMedian;
|
||||
if (valore >= contOreMaccOn)
|
||||
{
|
||||
// processo comunque sempre...
|
||||
double contatore = updateValDoubleByIncr(0, delta, "ACC_TIME");
|
||||
currAdpConf.ContOreMaccOn += delta;
|
||||
// salvo valore su persistent layer
|
||||
mAccTime.Value = contatore.ToString("0.000", CultureInfo.InvariantCulture);
|
||||
// controllo incremento...
|
||||
if (delta > 0)
|
||||
delta = valore - contOreMaccOn;
|
||||
// controllo delta < 50% max...
|
||||
if (delta < double.MaxValue / 2)
|
||||
{
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
// processo comunque sempre...
|
||||
double contatore = updateValDoubleByIncr(0, delta, "ACC_TIME");
|
||||
currAdpConf.ContOreMaccOn += delta;
|
||||
// salvo valore su persistent layer
|
||||
mAccTime.Value = contatore.ToString("0.000", CultureInfo.InvariantCulture);
|
||||
// controllo incremento...
|
||||
if (delta > 0)
|
||||
{
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
}
|
||||
}
|
||||
// salvo su maschera...
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine(string.Format("ACC_TIME: {0}", mAccTime.Value));
|
||||
parentForm.dataMonitor_1 += sb.ToString();
|
||||
|
||||
// ...aggiorno valore riferimento...
|
||||
contOreMaccOn = istOreMaccOn.vcMedian;
|
||||
}
|
||||
// ...aggiorno valore riferimento...
|
||||
contOreMaccOn = valore;
|
||||
}
|
||||
// salvo su maschera...
|
||||
sb.AppendLine(string.Format("ACC_TIME: {0}", mAccTime.Value));
|
||||
parentForm.dataMonitor_1 += sb.ToString();
|
||||
return needSave;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -4159,31 +4207,36 @@ namespace MTC_Adapter
|
||||
/// <returns></returns>
|
||||
public bool procOreMaccLav(bool needSave)
|
||||
{
|
||||
double delta = 0;
|
||||
double valore = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (istOreMaccLav.vcValid)
|
||||
{
|
||||
double delta = istOreMaccLav.vcMedian - contOreMaccLav;
|
||||
// controllo delta < 50% max...
|
||||
if (delta < double.MaxValue / 2)
|
||||
valore = istOreMaccLav.vcMedian;
|
||||
if (valore >= contOreMaccLav)
|
||||
{
|
||||
double contatore = updateValDoubleByIncr(0, delta, "ACC_TIME_WORK");
|
||||
currAdpConf.ContOreMaccLav += delta;
|
||||
// salvo valore su persistent layer
|
||||
mAccTimeWork.Value = contatore.ToString("0.000", CultureInfo.InvariantCulture);
|
||||
// controllo valore riferimento...
|
||||
if (delta > 0)
|
||||
delta = valore - contOreMaccLav;
|
||||
// controllo delta < 50% max...
|
||||
if (delta < double.MaxValue / 2)
|
||||
{
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
double contatore = updateValDoubleByIncr(0, delta, "ACC_TIME_WORK");
|
||||
currAdpConf.ContOreMaccLav += delta;
|
||||
// salvo valore su persistent layer
|
||||
mAccTimeWork.Value = contatore.ToString("0.000", CultureInfo.InvariantCulture);
|
||||
// controllo valore riferimento...
|
||||
if (delta > 0)
|
||||
{
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
}
|
||||
}
|
||||
// salvo su maschera...
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine(string.Format("ACC_TIME_WORK: {0}", mAccTimeWork.Value));
|
||||
parentForm.dataMonitor_1 += sb.ToString();
|
||||
|
||||
// ...aggiorno valore riferimento...
|
||||
contOreMaccLav = istOreMaccLav.vcMedian;
|
||||
}
|
||||
// ...aggiorno valore riferimento...
|
||||
contOreMaccLav = valore;
|
||||
}
|
||||
// salvo su maschera...
|
||||
sb.AppendLine(string.Format("ACC_TIME_WORK: {0}", mAccTimeWork.Value));
|
||||
parentForm.dataMonitor_1 += sb.ToString();
|
||||
return needSave;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -4193,31 +4246,36 @@ namespace MTC_Adapter
|
||||
/// <returns></returns>
|
||||
public bool procSlittaTast(bool needSave)
|
||||
{
|
||||
double delta = 0;
|
||||
double valore = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (istSlittaTast.vcValid)
|
||||
{
|
||||
double delta = istSlittaTast.vcMedian - contSlittaTast;
|
||||
// controllo delta < 50% max...
|
||||
if (delta < double.MaxValue / 2)
|
||||
valore = istSlittaTast.vcMedian;
|
||||
if (valore >= contSlittaTast)
|
||||
{
|
||||
double contatore = updateValDoubleByIncr(0, delta, "SlittaTastatore_Count");
|
||||
currAdpConf.ContSlittaTast += delta;
|
||||
// salvo valore su persistent layer
|
||||
mSlittaTast.Value = contatore.ToString("0", CultureInfo.InvariantCulture);
|
||||
// controllo valore riferimento...
|
||||
if (delta > 0)
|
||||
delta = valore - contSlittaTast;
|
||||
// controllo delta < 50% max...
|
||||
if (delta < double.MaxValue / 2)
|
||||
{
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
double contatore = updateValDoubleByIncr(0, delta, "SlittaTastatore_Count");
|
||||
currAdpConf.ContSlittaTast += delta;
|
||||
// salvo valore su persistent layer
|
||||
mSlittaTast.Value = contatore.ToString("0", CultureInfo.InvariantCulture);
|
||||
// controllo valore riferimento...
|
||||
if (delta > 0)
|
||||
{
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
}
|
||||
}
|
||||
// salvo su maschera...
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine(string.Format("SlittaTastatore_Count: {0}", mSlittaTast.Value));
|
||||
parentForm.dataMonitor_1 += sb.ToString();
|
||||
|
||||
// ...aggiorno valore riferimento...
|
||||
contSlittaTast = istSlittaTast.vcMedian;
|
||||
}
|
||||
// ...aggiorno valore riferimento...
|
||||
contSlittaTast = valore;
|
||||
}
|
||||
// salvo su maschera...
|
||||
sb.AppendLine(string.Format("SlittaTastatore_Count: {0}", mSlittaTast.Value));
|
||||
parentForm.dataMonitor_1 += sb.ToString();
|
||||
return needSave;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -4292,7 +4350,6 @@ namespace MTC_Adapter
|
||||
if (istPathPartCount[i].vcMedian > currPathPartCount[i])
|
||||
{
|
||||
uint delta = Convert.ToUInt32(istPathPartCount[i].vcMedian) - currPathPartCount[i];
|
||||
//uint contatore = updatePathRefListByIncr(i, delta, "Path_{0:00}_PZ_TOT");
|
||||
uint contatore = updateValUIntByIncr(i, delta, "Path_{0:00}_PZ_TOT");
|
||||
// passo valore num pz all'adapter
|
||||
vettPath[i].mPathPartCount.Value = contatore;
|
||||
@@ -4656,49 +4713,6 @@ namespace MTC_Adapter
|
||||
return needSave;
|
||||
}
|
||||
/// <summary>
|
||||
/// Processing delle variabili generiche Counters
|
||||
/// </summary>
|
||||
/// <param name="needSave"></param>
|
||||
/// <returns></returns>
|
||||
public bool procCounters(bool needSave)
|
||||
{
|
||||
uint delta = 0;
|
||||
uint valore = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < mCounters.Length; i++)
|
||||
{
|
||||
// procedo solo SE HO FINESTRA VALIDA...
|
||||
if (istCounters[i].vcValid)
|
||||
{
|
||||
valore = Convert.ToUInt32(istCounters[i].vcMedian);
|
||||
if (valore >= currCounters[i])
|
||||
{
|
||||
delta = valore - currCounters[i];
|
||||
// controllo delta < 50% max...
|
||||
if (delta < uint.MaxValue / 2)
|
||||
{
|
||||
//processo comunque sempre...
|
||||
uint contTot = updateValUIntByIncr(i, delta, "Counter_{0:000}");
|
||||
// passo valore totale all'adapter
|
||||
mCounters[i].Value = contTot;
|
||||
// controllo valore riferimento...
|
||||
if (delta > 0)
|
||||
{
|
||||
// segnalo necessità salvataggio!
|
||||
needSave = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ...aggiorno valore riferimento...
|
||||
currCounters[i] = valore;
|
||||
}
|
||||
sb.AppendLine(mCounters[i].ToString().Replace("|", " | "));
|
||||
}
|
||||
// salvo su maschera...
|
||||
parentForm.dataMonitor_2 += sb.ToString();
|
||||
return needSave;
|
||||
}
|
||||
/// <summary>
|
||||
/// Processing delle variabili sui componenti SlittaMag
|
||||
/// </summary>
|
||||
/// <param name="needSave"></param>
|
||||
|
||||
Reference in New Issue
Block a user