Ok processing settimane consumo passate...
This commit is contained in:
+30
-12
@@ -6057,8 +6057,8 @@ namespace IOB_WIN_NEXT
|
||||
// ora cerca nella folder locale e processa i files...
|
||||
bool okCheck = RecipeDoCheckFileProc(tempPath, archBasePath);
|
||||
|
||||
// verifica se sia da creare/inviare il record settimanale di consumo
|
||||
bool okSent = RecipeDoProcCons(archBasePath, "W");
|
||||
// verifica se sia da creare/inviare il record settimanale di consumo (dopo la mezzanotte del lunedì inizio settimana)
|
||||
bool okSent = RecipeDoProcCons();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -6141,8 +6141,6 @@ namespace IOB_WIN_NEXT
|
||||
protected virtual bool RecipeDoCheckFileProc(string localPath, string archBasePath)
|
||||
{
|
||||
bool answ = false;
|
||||
DateTime adesso = DateTime.Now;
|
||||
Calendar cal = new CultureInfo("it-IT").Calendar;
|
||||
List<string> weekProcNew = new List<string>();
|
||||
|
||||
// recupero elenco files...
|
||||
@@ -6191,8 +6189,10 @@ namespace IOB_WIN_NEXT
|
||||
// salvo in redis...
|
||||
string fullKey = redisMan.redHash($"IOB:Status:{cIobConf.codIOB}:WeekStats");
|
||||
var okHashDict = redisMan.redSaveHashDict(fullKey, redHashWeek);
|
||||
#if false
|
||||
// manda a MP-IO update delle settimane processate (+ azioni)
|
||||
var currStats = redisMan.redGetHashDict(fullKey);
|
||||
Dictionary<string, string> currStats = redisMan.redGetHashDict(fullKey);
|
||||
#endif
|
||||
// invio ANCHE in MP-IO l'update delle info...
|
||||
string remUrl = urlSetHashDict;
|
||||
string dictPayload = JsonConvert.SerializeObject(redHashWeek);
|
||||
@@ -6208,16 +6208,34 @@ namespace IOB_WIN_NEXT
|
||||
/// <summary>
|
||||
/// Verifica se si debba registrare/inviare il report periodico di consumo indicato
|
||||
/// </summary>
|
||||
/// <param name="archBasePath"></param>
|
||||
/// <param name="repType">Report di consumo: D/W/M (day, week, month...)</param>
|
||||
/// <returns></returns>
|
||||
protected bool RecipeDoProcCons(string archBasePath, string repType)
|
||||
protected bool RecipeDoProcCons()
|
||||
{
|
||||
bool answ = false;
|
||||
// NB: invio AS400 inKG, 2 decimali (N2)
|
||||
|
||||
// implementare d Dict task da eseguire, x ogni settimana PASSATA effettua SendArch....
|
||||
|
||||
// calcolo quale sia la settimana corrente...
|
||||
int week = 0;
|
||||
DateTime adesso = DateTime.Now;
|
||||
Calendar cal = new CultureInfo("it-IT").Calendar;
|
||||
// calcolo week da data-ora file...
|
||||
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:{cIobConf.codIOB}:WeekStats");
|
||||
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...)
|
||||
foreach (var weekData in currStats)
|
||||
{
|
||||
if (weekData.Key != currWeek)
|
||||
{
|
||||
// ...x ogni settimana PASSATA effettua SendArch... --> lancia un task!
|
||||
processOtherInfo(weekData.Key, "SendArch");
|
||||
}
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,9 +129,11 @@ namespace IOB_WIN_NEXT
|
||||
// effettua process ritorno ricette
|
||||
processRecipeFileRet();
|
||||
|
||||
// eseguo test x ricette CABLATO...
|
||||
processOtherInfo("2023-05", "SendArch");
|
||||
//processOtherInfo("2023-05", "Arch");
|
||||
// eseguo verifica/lancio ricette
|
||||
RecipeDoProcCons();
|
||||
//// eseguo test x ricette CABLATO...
|
||||
//processOtherInfo("2023-05", "SendArch");
|
||||
////processOtherInfo("2023-05", "Arch");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user