Spostamento helper in baseObj
This commit is contained in:
+11
-53
@@ -319,38 +319,20 @@ namespace IOB_UT_NEXT.Iob
|
||||
/// <summary>
|
||||
/// Verifica se sia in modalità DEMO avanzata (campionamento da set di valori ammessi...)
|
||||
/// </summary>
|
||||
public static bool DemoInSample
|
||||
{
|
||||
get
|
||||
{
|
||||
return baseUtils.CRB("DemoInSample");
|
||||
}
|
||||
}
|
||||
public static bool DemoInSample => baseUtils.CRB("DemoInSample");
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se sia in modalità DEMO x dati OUTPUT
|
||||
/// </summary>
|
||||
public static bool DemoOut
|
||||
{
|
||||
get
|
||||
{
|
||||
return utils.CRB("DemoOut");
|
||||
}
|
||||
}
|
||||
public static bool DemoOut => utils.CRB("DemoOut");
|
||||
|
||||
/// <summary>
|
||||
/// Indicazione VETO PING a server sino alla data-ora indicata
|
||||
/// </summary>
|
||||
public static DateTime dtVetoPing
|
||||
{
|
||||
get
|
||||
{
|
||||
return utils.dtVetoPing;
|
||||
}
|
||||
set
|
||||
{
|
||||
utils.dtVetoPing = value;
|
||||
}
|
||||
get => utils.dtVetoPing;
|
||||
set => utils.dtVetoPing = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -358,14 +340,8 @@ namespace IOB_UT_NEXT.Iob
|
||||
/// </summary>
|
||||
public static DateTime dtVetoQueueIN
|
||||
{
|
||||
get
|
||||
{
|
||||
return utils.dtVetoQueueIN;
|
||||
}
|
||||
set
|
||||
{
|
||||
utils.dtVetoQueueIN = value;
|
||||
}
|
||||
get => utils.dtVetoQueueIN;
|
||||
set => utils.dtVetoQueueIN = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -373,40 +349,22 @@ namespace IOB_UT_NEXT.Iob
|
||||
/// </summary>
|
||||
public static DateTime dtVetoSend
|
||||
{
|
||||
get
|
||||
{
|
||||
return utils.dtVetoSend;
|
||||
}
|
||||
set
|
||||
{
|
||||
utils.dtVetoSend = value;
|
||||
}
|
||||
get => utils.dtVetoSend;
|
||||
set => utils.dtVetoSend = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se sia abilitato test lettura blocchi memoria all'avvio
|
||||
/// </summary>
|
||||
public static bool EnableTest
|
||||
{
|
||||
get
|
||||
{
|
||||
return baseUtils.CRB("enableTest");
|
||||
}
|
||||
}
|
||||
public static bool EnableTest => baseUtils.CRB("enableTest");
|
||||
|
||||
/// <summary>
|
||||
/// stato Online/Offline del server MP IO (su REDIS)
|
||||
/// </summary>
|
||||
public static bool MPOnline
|
||||
{
|
||||
get
|
||||
{
|
||||
return utils.MPIO_Online;
|
||||
}
|
||||
set
|
||||
{
|
||||
utils.MPIO_Online = value;
|
||||
}
|
||||
get => utils.MPIO_Online;
|
||||
set => utils.MPIO_Online = value;
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
<Compile Include="Iob\Generic.cs" />
|
||||
<Compile Include="Iob\PingWatchDog.cs" />
|
||||
<Compile Include="Iob\Services\DataSerializer.cs" />
|
||||
<Compile Include="Iob\Services\RedisService.cs" />
|
||||
<Compile Include="Iob\Services\XmlDataSerializer.cs" />
|
||||
<Compile Include="Iob\Simula.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
|
||||
+24
-32
@@ -61,9 +61,6 @@ namespace IOB_WIN_FORM.Iob
|
||||
// init oggetto redis...
|
||||
redisMan = new RedisIobCache(IobConfNew.MapoMes.IpAddr, IobConfNew.General.FilenameIOB, $"{IobConfNew.General.IobType}", IobConfNew.General.MinDeltaSec);
|
||||
|
||||
// init RedisService per astrarre le chiamate alla cache
|
||||
redisService = new RedisService(redisMan, IobConfNew.General.FilenameIOB, IobConfNew.General.IobType);
|
||||
|
||||
// init code
|
||||
SetupQueue();
|
||||
|
||||
@@ -1974,9 +1971,9 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <returns></returns>
|
||||
public DateTime LastSendGet(string keyReq)
|
||||
{
|
||||
DateTime lastSend = DateTime.Now.AddDays(-1);
|
||||
string lastSendKey = redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:LastSend");
|
||||
string rawVal = redisMan.redGetHashField(lastSendKey, keyReq);
|
||||
DateTime lastSend = DateTime.Now.AddDays(-1);
|
||||
string lastSendKey = GetStatusField("LastSend");
|
||||
string rawVal = redisMan.redGetHashField(lastSendKey, keyReq);
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
lastSend = DataSerializer.Deserialize<DateTime>(rawVal);
|
||||
@@ -1998,7 +1995,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <param name="dtRif"></param>
|
||||
public bool LastSendSet(string keyReq, DateTime dtRif)
|
||||
{
|
||||
string lastSendKey = redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:LastSend");
|
||||
string lastSendKey = GetStatusField("LastSend");
|
||||
string rawVal = DataSerializer.Serialize(dtRif);
|
||||
KeyValuePair<string, string>[] hashFields = new KeyValuePair<string, string>[1];
|
||||
hashFields[0] = new KeyValuePair<string, string>(keyReq, rawVal);
|
||||
@@ -3690,7 +3687,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
parentForm.displayTaskAndLog("[STOP] Stopping adapter - last periodic data read...", true);
|
||||
|
||||
// salvo statistiche
|
||||
string callKey = redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:CallStats");
|
||||
string callKey = GetCallStatsKey();
|
||||
await CallMetricsCollector.SaveToRedisAsync(redisMan.currDb, callKey, false);
|
||||
|
||||
// chiudo la connessione all'adapter...
|
||||
@@ -4666,8 +4663,8 @@ namespace IOB_WIN_FORM.Iob
|
||||
get
|
||||
{
|
||||
Dictionary<int, PODLModel> answ = new Dictionary<int, PODLModel>();
|
||||
string redKey = redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:POdlSent");
|
||||
string rawData = redisMan.getRSV(redKey);
|
||||
string redKey = GetPOdlSentKey();
|
||||
string rawData = redisMan.getRSV(redKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
try
|
||||
@@ -4685,8 +4682,8 @@ namespace IOB_WIN_FORM.Iob
|
||||
set
|
||||
{
|
||||
string rawVal = JsonConvert.SerializeObject(value);
|
||||
string redKey = redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:POdlSent");
|
||||
redisMan.setRSV(redKey, rawVal);
|
||||
string redKey = GetPOdlSentKey();
|
||||
redisMan.setRSV(redKey, rawVal);
|
||||
lgDebug($"Salvataggio status POdlSentFileArch | {value.Count} record");
|
||||
}
|
||||
}
|
||||
@@ -4756,10 +4753,10 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <summary>
|
||||
/// Redis key del dizionari valori DataItemMem persistiti
|
||||
/// </summary>
|
||||
protected string rKeyFluxMem
|
||||
{
|
||||
get => redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:FluxMem");
|
||||
}
|
||||
protected string rKeyFluxMem
|
||||
{
|
||||
get => GetFluxMemKey();
|
||||
}
|
||||
|
||||
protected Random rndGen { get; set; } = new Random();
|
||||
|
||||
@@ -6892,9 +6889,9 @@ namespace IOB_WIN_FORM.Iob
|
||||
string rawWeek = JsonConvert.SerializeObject(cPerInfo);
|
||||
redHashWeek.Add(cWeek, rawWeek);
|
||||
}
|
||||
// salvo in redis...
|
||||
string fullKey = redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:WeekStats");
|
||||
var okHashDict = redisMan.redSaveHashDict(fullKey, redHashWeek);
|
||||
// salvo in redis...
|
||||
string fullKey = GetWeekStatsKey();
|
||||
var okHashDict = redisMan.redSaveHashDict(fullKey, redHashWeek);
|
||||
|
||||
// invio ANCHE in MP-IO l'update delle info...
|
||||
string remUrl = urlSetHashDict;
|
||||
@@ -6922,9 +6919,9 @@ namespace IOB_WIN_FORM.Iob
|
||||
week = cal.GetWeekOfYear(adesso, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
|
||||
// verifico se ci sia la settimana indicata in elenco...
|
||||
string currWeek = $"{adesso:yyyy}-{week:00}";
|
||||
// recupero elenco delle settimane da processare da redis/WeekStats
|
||||
string fullKey = redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:WeekStats");
|
||||
Dictionary<string, string> currStats = redisMan.redGetHashDict(fullKey);
|
||||
// recupero elenco delle settimane da processare da redis/WeekStats
|
||||
string fullKey = GetWeekStatsKey();
|
||||
Dictionary<string, string> currStats = redisMan.redGetHashDict(fullKey);
|
||||
if (currStats != null && currStats.Count > 0)
|
||||
{
|
||||
// definisco il DICT delle settimane da processare (= settimane passate, NON la corrente...)
|
||||
@@ -9063,12 +9060,7 @@ namespace IOB_WIN_FORM.Iob
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto gestione connessioni REDIS
|
||||
/// </summary>
|
||||
private RedisService redisService;
|
||||
|
||||
|
||||
private async Task<bool> ExecuteIobCheckWithRetry(int maxRetries)
|
||||
{
|
||||
var rand = new Random();
|
||||
@@ -9684,10 +9676,10 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <param name="keyReq"></param>
|
||||
private async Task RecipeRemoveWeekStatus(string keyReq)
|
||||
{
|
||||
string fullKey = redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:WeekStats");
|
||||
var okHashDict = redisMan.redRemoveHashField(fullKey, keyReq);
|
||||
// rileggo status hash
|
||||
Dictionary<string, string> currDict = redisMan.redGetHashDict(fullKey);
|
||||
string fullKey = GetWeekStatsKey();
|
||||
var okHashDict = redisMan.redRemoveHashField(fullKey, keyReq);
|
||||
// rileggo status hash
|
||||
Dictionary<string, string> currDict = redisMan.redGetHashDict(fullKey);
|
||||
// invio ANCHE in MP-IO l'update delle info...
|
||||
string remUrl = urlSetHashDict;
|
||||
string dictPayload = JsonConvert.SerializeObject(currDict);
|
||||
|
||||
Reference in New Issue
Block a user