diff --git a/AppData/ComLib.cs b/AppData/ComLib.cs
index 39bdaaf..317ced6 100644
--- a/AppData/ComLib.cs
+++ b/AppData/ComLib.cs
@@ -1165,9 +1165,13 @@ namespace AppData
///
/// Chiave bunk corrente su redis
///
- protected static string redCurrBunkTabKey()
+ protected static string redCurrBunkTabKey(string machine)
{
- return $"{redProdReq}:CurrBunks";
+ if (string.IsNullOrEmpty(machine))
+ {
+ machine = "WRK001";
+ }
+ return $"{redProdReq}:CurrBunks:{machine}";
}
///
/// Chiave bunk corrente su redis
@@ -1436,20 +1440,20 @@ namespace AppData
/// BUNK corrente (x ora copia di first, poi sarĂ quello SELEZIONATO tra quelli SELEZIONABILI)
///
///
- public static DS_App.StackListRow getCurrBunk()
+ public static DS_App.StackListRow getCurrBunk(string machine = "WRK001")
{
DS_App.StackListRow answ = null;
DS_App.StackListDataTable tabBunk = null;
// cerco in cache....
- if (cachedCurrBunkTab != null)
+ if (getCurrBunkTab(machine) != null)
{
- tabBunk = cachedCurrBunkTab;
+ tabBunk = getCurrBunkTab(machine);
}
else
{
tabBunk = DataLayer.man.taSTL.getLoaded();
// salvo in redis
- cachedCurrBunkTab = tabBunk;
+ setCurrBunkTab(machine, tabBunk);
}
if (tabBunk != null && tabBunk.Count > 0)
{
@@ -1457,31 +1461,46 @@ namespace AppData
}
return answ;
}
-
- protected static DS_App.StackListDataTable cachedCurrBunkTab
+ ///
+ /// resetto curr bunk
+ ///
+ ///
+ protected static void resetCurrBunk(string machine = "WRK001")
{
- get
+ // svuoto"
+ memLayer.ML.redFlushKey(redCurrBunkTabKey(machine));
+ }
+ ///
+ /// lettura currBunk table da cache
+ ///
+ ///
+ ///
+ protected static DS_App.StackListDataTable getCurrBunkTab(string machine)
+ {
+ DS_App.StackListDataTable answ = null;
+ string rawData = memLayer.ML.getRSV(redCurrBunkTabKey(machine));
+ if (!string.IsNullOrEmpty(rawData))
{
- DS_App.StackListDataTable answ = null;
- string rawData = memLayer.ML.getRSV(redCurrBunkTabKey());
- if (!string.IsNullOrEmpty(rawData))
+ try
{
- try
- {
- // deserializzo...
- answ = JsonConvert.DeserializeObject(rawData);
- }
- catch
- { }
+ // deserializzo...
+ answ = JsonConvert.DeserializeObject(rawData);
}
- return answ;
- }
- set
- {
- string rawData = JsonConvert.SerializeObject(value);
- // TTL 5 sec
- memLayer.ML.setRSV(redCurrBunkTabKey(), rawData, 5);
+ catch
+ { }
}
+ return answ;
+ }
+ ///
+ /// salvataggio inc ache currBunk table
+ ///
+ ///
+ ///
+ protected static void setCurrBunkTab(string machine, DS_App.StackListDataTable tabBunks)
+ {
+ string rawData = JsonConvert.SerializeObject(tabBunks);
+ // TTL 15 sec
+ memLayer.ML.setRSV(redCurrBunkTabKey(machine), rawData, 15);
}
///