typo + fix modalità controllo valore insEnabled + IOB CONDIZIONALE nel modo controllo DB/REDis

This commit is contained in:
Samuele E. Locatelli
2017-09-12 13:49:49 +02:00
parent ad6bb50aa2
commit e11d56ac92
2 changed files with 34 additions and 30 deletions
+9 -8
View File
@@ -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)
{
+25 -22
View File
@@ -549,7 +549,7 @@ namespace MapoDb
}
#region gestione dati macchina
/// <summary>
/// Restitusice elenco KVP dei campi DatiMacchine + StatoMacchine per l'impianto indicato
/// </summary>
@@ -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<string, string>[] answ = new KeyValuePair<string, string>[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<string, string>("palletChange", item.palletChange.ToString());
answ[1] = new KeyValuePair<string, string>("CodArticolo_A", item.CodArticolo_A);
answ[2] = new KeyValuePair<string, string>("CodArticolo_B", item.CodArticolo_B);
answ[3] = new KeyValuePair<string, string>("simplePallet", item.simplePallet.ToString());
answ[4] = new KeyValuePair<string, string>("insEnabled", item.insEnabled.ToString());
answ[5] = new KeyValuePair<string, string>("sLogEnabled", item.sLogEnabled.ToString());
answ[6] = new KeyValuePair<string, string>("IdxStato", item.IdxStato.ToString());
answ[7] = new KeyValuePair<string, string>("IdxFamIn", item.IdxFamigliaIngresso.ToString());
answ[8] = new KeyValuePair<string, string>("IdxFamMacc", item.IdxFamiglia.ToString());
answ[9] = new KeyValuePair<string, string>("CodArticolo", item.CodArticolo);
answ[10] = new KeyValuePair<string, string>("TempoCicloBase", item.TempoCicloBase.ToString());
answ[11] = new KeyValuePair<string, string>("PzPalletProd", item.PzPalletProd.ToString());
answ[12] = new KeyValuePair<string, string>("MatrOpr", item.MatrOpr.ToString());
answ[13] = new KeyValuePair<string, string>("IdxMicroStato", item.IdxMicroStato.ToString());
answ[14] = new KeyValuePair<string, string>("pallet", item.pallet);
answ[15] = new KeyValuePair<string, string>("lastVal", item.lastVal);
answ[16] = new KeyValuePair<string, string>("TCBase", item.TempoCicloBase.ToString());
answ[17] = new KeyValuePair<string, string>("CodMacc", item.codmacchina);
answ[0] = new KeyValuePair<string, string>("palletChange", rigaMSFD.palletChange.ToString());
answ[1] = new KeyValuePair<string, string>("CodArticolo_A", rigaMSFD.CodArticolo_A);
answ[2] = new KeyValuePair<string, string>("CodArticolo_B", rigaMSFD.CodArticolo_B);
answ[3] = new KeyValuePair<string, string>("simplePallet", rigaMSFD.simplePallet.ToString());
answ[4] = new KeyValuePair<string, string>("insEnabled", rigaMSFD.insEnabled.ToString());
answ[5] = new KeyValuePair<string, string>("sLogEnabled", rigaMSFD.sLogEnabled.ToString());
answ[6] = new KeyValuePair<string, string>("IdxStato", rigaMSFD.IdxStato.ToString());
answ[7] = new KeyValuePair<string, string>("IdxFamIn", rigaMSFD.IdxFamigliaIngresso.ToString());
answ[8] = new KeyValuePair<string, string>("IdxFamMacc", rigaMSFD.IdxFamiglia.ToString());
answ[9] = new KeyValuePair<string, string>("CodArticolo", rigaMSFD.CodArticolo);
answ[10] = new KeyValuePair<string, string>("TempoCicloBase", rigaMSFD.TempoCicloBase.ToString());
answ[11] = new KeyValuePair<string, string>("PzPalletProd", rigaMSFD.PzPalletProd.ToString());
answ[12] = new KeyValuePair<string, string>("MatrOpr", rigaMSFD.MatrOpr.ToString());
answ[13] = new KeyValuePair<string, string>("IdxMicroStato", rigaMSFD.IdxMicroStato.ToString());
answ[14] = new KeyValuePair<string, string>("pallet", rigaMSFD.pallet);
answ[15] = new KeyValuePair<string, string>("lastVal", rigaMSFD.lastVal);
answ[16] = new KeyValuePair<string, string>("TCBase", rigaMSFD.TempoCicloBase.ToString());
answ[17] = new KeyValuePair<string, string>("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!