diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs
index aa3b03f4..708f63ac 100644
--- a/MP-IO/Controllers/IOBController.cs
+++ b/MP-IO/Controllers/IOBController.cs
@@ -13,10 +13,6 @@ namespace MP_IO.Controllers
return "OK";
}
- // disabilitato: non vale la pena
- //// GET: IOB/enabled/5 - tenuta in cache per 5 sec...
- //[OutputCache(Duration = 5, VaryByParam = "id")]
-
// GET: IOB/enabled/5
public string enabled(int? id)
{
@@ -30,17 +26,22 @@ namespace MP_IO.Controllers
{
int idx = 0;
Int32.TryParse(id.ToString(), out idx);
+
try
{
- // verifico se sia abilitato INSERT x una data macchina
- if (MapoDb.MapoDb.obj.insEnabled(idx))
+ bool insEnabled = false;
+ // verifico se sia abilitato INSERT x una data macchina... con REDIS se abilitato
+ if (memLayer.ML.CRB("IOB_RedEnab"))
{
- answ = "OK";
+ insEnabled = DataLayer.insEnab(idx);
}
+ // ...oppure dritto su DB
else
{
- answ = "NO";
+ insEnabled = MapoDb.MapoDb.obj.insEnabled(idx);
}
+ // salvo risposta!
+ answ = insEnabled ? "OK" : "NO";
}
catch (Exception exc)
{
diff --git a/MapoDb/DataLayer.cs b/MapoDb/DataLayer.cs
index 480a9fda..5ba4ef61 100644
--- a/MapoDb/DataLayer.cs
+++ b/MapoDb/DataLayer.cs
@@ -549,7 +549,7 @@ namespace MapoDb
}
#region gestione dati macchina
-
+
///
/// Restitusice elenco KVP dei campi DatiMacchine + StatoMacchine per l'impianto indicato
///
@@ -572,7 +572,7 @@ namespace MapoDb
answ = resetDatiMacchina(idxMacchina);
}
}
- catch(Exception exc)
+ catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in compilazione dati Macchine x Redis:{0}{1}", Environment.NewLine, exc));
}
@@ -590,32 +590,35 @@ namespace MapoDb
memLayer.ML.redFlushKey(currHash);
KeyValuePair[] answ = new KeyValuePair[18];
DS_applicazione.MSFDDataTable tabMSFD = MapoDb.obj.taMSFD.getByIdxMacc(idxMacchina.ToString());
- foreach (var item in tabMSFD)
+ try
{
+ DS_applicazione.MSFDRow rigaMSFD = tabMSFD[0];
// salvo 1:1 i valori...
- answ[0] = new KeyValuePair("palletChange", item.palletChange.ToString());
- answ[1] = new KeyValuePair("CodArticolo_A", item.CodArticolo_A);
- answ[2] = new KeyValuePair("CodArticolo_B", item.CodArticolo_B);
- answ[3] = new KeyValuePair("simplePallet", item.simplePallet.ToString());
- answ[4] = new KeyValuePair("insEnabled", item.insEnabled.ToString());
- answ[5] = new KeyValuePair("sLogEnabled", item.sLogEnabled.ToString());
- answ[6] = new KeyValuePair("IdxStato", item.IdxStato.ToString());
- answ[7] = new KeyValuePair("IdxFamIn", item.IdxFamigliaIngresso.ToString());
- answ[8] = new KeyValuePair("IdxFamMacc", item.IdxFamiglia.ToString());
- answ[9] = new KeyValuePair("CodArticolo", item.CodArticolo);
- answ[10] = new KeyValuePair("TempoCicloBase", item.TempoCicloBase.ToString());
- answ[11] = new KeyValuePair("PzPalletProd", item.PzPalletProd.ToString());
- answ[12] = new KeyValuePair("MatrOpr", item.MatrOpr.ToString());
- answ[13] = new KeyValuePair("IdxMicroStato", item.IdxMicroStato.ToString());
- answ[14] = new KeyValuePair("pallet", item.pallet);
- answ[15] = new KeyValuePair("lastVal", item.lastVal);
- answ[16] = new KeyValuePair("TCBase", item.TempoCicloBase.ToString());
- answ[17] = new KeyValuePair("CodMacc", item.codmacchina);
+ answ[0] = new KeyValuePair("palletChange", rigaMSFD.palletChange.ToString());
+ answ[1] = new KeyValuePair("CodArticolo_A", rigaMSFD.CodArticolo_A);
+ answ[2] = new KeyValuePair("CodArticolo_B", rigaMSFD.CodArticolo_B);
+ answ[3] = new KeyValuePair("simplePallet", rigaMSFD.simplePallet.ToString());
+ answ[4] = new KeyValuePair("insEnabled", rigaMSFD.insEnabled.ToString());
+ answ[5] = new KeyValuePair("sLogEnabled", rigaMSFD.sLogEnabled.ToString());
+ answ[6] = new KeyValuePair("IdxStato", rigaMSFD.IdxStato.ToString());
+ answ[7] = new KeyValuePair("IdxFamIn", rigaMSFD.IdxFamigliaIngresso.ToString());
+ answ[8] = new KeyValuePair("IdxFamMacc", rigaMSFD.IdxFamiglia.ToString());
+ answ[9] = new KeyValuePair("CodArticolo", rigaMSFD.CodArticolo);
+ answ[10] = new KeyValuePair("TempoCicloBase", rigaMSFD.TempoCicloBase.ToString());
+ answ[11] = new KeyValuePair("PzPalletProd", rigaMSFD.PzPalletProd.ToString());
+ answ[12] = new KeyValuePair("MatrOpr", rigaMSFD.MatrOpr.ToString());
+ answ[13] = new KeyValuePair("IdxMicroStato", rigaMSFD.IdxMicroStato.ToString());
+ answ[14] = new KeyValuePair("pallet", rigaMSFD.pallet);
+ answ[15] = new KeyValuePair("lastVal", rigaMSFD.lastVal);
+ answ[16] = new KeyValuePair("TCBase", rigaMSFD.TempoCicloBase.ToString());
+ answ[17] = new KeyValuePair("CodMacc", rigaMSFD.codmacchina);
}
+ catch
+ { }
// verifico il timeout che cambia a seconda che sia vero o falso insEnabled...
int tOutShort = memLayer.ML.cdvi("TmOut.MS.S");
int tOutLong = memLayer.ML.cdvi("TmOut.MS.L");
- int redDtMacTOut = (answ[4].Value=="true") ? tOutShort: tOutLong;
+ int redDtMacTOut = (answ[4].Value.ToLower() == "true") ? tOutShort : tOutLong;
//int redDtMacTOut = (memLayer.ML.CRI("redDtMacTOut") <= 0) ? 60 : memLayer.ML.CRI("redDtMacTOut");
// salvo in redis!