fix di affinamento modalità disconnessione/riavvio connessione...
This commit is contained in:
@@ -160,6 +160,8 @@ namespace MTC_Adapter
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Fatal(exc, "Errore nella connessione all'adapter FANUC", szStatusConnection);
|
||||
connectionOk = false;
|
||||
lg.Info(string.Format("Segnalo Adapter NON running, pausa di {0} msec prima di ulteriori tentativi di riconnessione", utils.CRI("waitRecMSec")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace MTC_Adapter
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
@@ -1607,8 +1608,10 @@ namespace MTC_Adapter
|
||||
// log connessione KO
|
||||
lg.Error("CicloMF - Connessione non disponibile, provo a riconnettere");
|
||||
// provo a riconnettere SE abilitato tryRestart...
|
||||
if (adpTryRestart)
|
||||
if (adpTryRestart && !connectionOk)
|
||||
{
|
||||
//// aspetto un tempo di wait adatto
|
||||
//Thread.Sleep(utils.CRI("waitRecMSec"));
|
||||
tryConnect();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<add key="windowCanMax" value="true" />
|
||||
<add key="trayClose" value="true" />
|
||||
<add key="autoSaveSec" value="60" />
|
||||
<add key="waitRecMSec" value="1000" />
|
||||
<add key="waitRecMSec" value="5000" />
|
||||
<add key="testCharSep" value="|" />
|
||||
<add key="fattdecimale" value="1000" />
|
||||
<add key="fattConvDistAssi" value="1000" />
|
||||
|
||||
@@ -139,18 +139,18 @@ namespace MTC_Adapter
|
||||
startTimerMs = utils.CRI("startTimerMs");
|
||||
|
||||
#if DEBUG
|
||||
// Setup the logging view for Sentinel - http://sentinel.codeplex.com
|
||||
var sentinalTarget = new NLogViewerTarget()
|
||||
{
|
||||
Name = "sentinal",
|
||||
Address = "udp://127.0.0.1:9999",
|
||||
IncludeNLogData = false
|
||||
};
|
||||
var sentinalRule = new LoggingRule("*", LogLevel.Trace, sentinalTarget);
|
||||
LogManager.Configuration.AddTarget("sentinal", sentinalTarget);
|
||||
LogManager.Configuration.LoggingRules.Add(sentinalRule);
|
||||
// Setup the logging view for Sentinel - http://sentinel.codeplex.com
|
||||
var sentinalTarget = new NLogViewerTarget()
|
||||
{
|
||||
Name = "sentinal",
|
||||
Address = "udp://127.0.0.1:9999",
|
||||
IncludeNLogData = false
|
||||
};
|
||||
var sentinalRule = new LoggingRule("*", LogLevel.Trace, sentinalTarget);
|
||||
LogManager.Configuration.AddTarget("sentinal", sentinalTarget);
|
||||
LogManager.Configuration.LoggingRules.Add(sentinalRule);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
LogManager.ReconfigExistingLoggers();
|
||||
@@ -530,22 +530,35 @@ namespace MTC_Adapter
|
||||
{
|
||||
// inizio a riportare che sto eseguendo..
|
||||
MainProgrBar.PerformStep();
|
||||
if (agObj.connectionOk)
|
||||
{
|
||||
|
||||
// eseguo eventuali simulazioni x dati/flags SE RICHIESTO
|
||||
simulateData();
|
||||
// eseguo eventuali simulazioni x dati/flags SE RICHIESTO
|
||||
simulateData();
|
||||
|
||||
// check esecuzione FastTask
|
||||
checkFastTask();
|
||||
// check esecuzione FastTask
|
||||
checkFastTask();
|
||||
|
||||
// check esecuzione NormTask
|
||||
checkNormTask();
|
||||
// check esecuzione NormTask
|
||||
checkNormTask();
|
||||
|
||||
// check esecuzione SlowTask
|
||||
checkSlowTask();
|
||||
// check esecuzione SlowTask
|
||||
checkSlowTask();
|
||||
|
||||
// check esecuzione AlarmSync
|
||||
checkAlarmSync();
|
||||
// check esecuzione AlarmSync
|
||||
checkAlarmSync();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
double currWait = DateTime.Now.Subtract(lastStartTry).TotalMilliseconds;
|
||||
if (agObj.adpTryRestart && currWait > utils.CRI("waitRecMSec"))
|
||||
{
|
||||
lastStartTry = DateTime.Now;
|
||||
agObj.tryConnect();
|
||||
agObj.loadPersData();
|
||||
}
|
||||
}
|
||||
// se è arrivato a MAX resetto...
|
||||
if (MainProgrBar.Value >= MainProgrBar.Maximum)
|
||||
{
|
||||
@@ -556,7 +569,7 @@ namespace MTC_Adapter
|
||||
{
|
||||
// verifico SE debba tentare il riavvio, ovvero NON running ma tryReconn e non ho riprovato x oltre waitRecMSec
|
||||
double currWait = DateTime.Now.Subtract(lastStartTry).TotalMilliseconds;
|
||||
if (agObj.adpTryRestart && currWait > utils.CRI("waitRecSec"))
|
||||
if (agObj.adpTryRestart && currWait > utils.CRI("waitRecMSec"))
|
||||
{
|
||||
lastStartTry = DateTime.Now;
|
||||
avviaAdapter();
|
||||
|
||||
Reference in New Issue
Block a user