diff --git a/MP-IO/Controllers/BENCH.cs b/MP-IO/Controllers/BENCH.cs
index 949f25c0..057007ed 100644
--- a/MP-IO/Controllers/BENCH.cs
+++ b/MP-IO/Controllers/BENCH.cs
@@ -8,299 +8,314 @@ using MP_IO.Interfaces;
namespace MP_IO.Controllers
{
- public class BENCHController : Controller, IBENCHService
- {
- ///
- /// Oggetto datalayer specifico
- ///
- DataLayer DataLayerObj = new DataLayer();
+ public class BENCHController : Controller, IBENCHService
+ {
+ #region Public Methods
- // GET: IOB (è un check alive)
- public string Index()
- {
- return "OK";
- }
+ // GET BENCH/CNTKEY/test
+ public string CNTKEY(string id)
+ {
+ string answ = "ND";
+ if (id == null) id = "";
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ // conto quanti oggetti ho in memoria REDIS...
+ string groupHash = ""; // DataLayer.mHash("");
+ if (id.Length > 0)
+ {
+ groupHash += id + ":";
+ }
+ groupHash += "*";
+ answ = string.Format("Trovate {0} Hash per {1}", memLayer.ML.redCountKey(groupHash), groupHash);
+ stopWatch.Stop();
+ // Get the elapsed time as a TimeSpan value.
+ TimeSpan ts = stopWatch.Elapsed;
+ // accodo tempo!
+ answ += string.Format("
Elapsed: {0}ms", ts.TotalMilliseconds);
+ // ritorno
+ return answ;
+ }
- // GET BENCH/RCLEAN/100
- public string RCLEAN(int? id)
- {
- string answ = "ND";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- // se id nullo --> KO!
- if (id == null)
- {
- answ = "KO";
- }
- else
- {
- string chiave;
- KeyValuePair[] valori = new KeyValuePair[2];
- try
+ // GET BENCH/DTMAC/SIMUL_01
+ public string DTMAC(string id)
{
- // svuoto i precedenti hash... CICLO!
- for (int i = 0; i < id; i++)
- {
- chiave = string.Format("test:{0}", i);
- memLayer.ML.redDelKey(chiave);
- }
- answ = "OK";
+ string answ = "ND";
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ // se id nullo --> KO!
+ if (id == null)
+ {
+ answ = "KO";
+ }
+ else
+ {
+ answ = "";
+ try
+ {
+ Dictionary valori = DataLayerObj.mDatiMacchine(id);
+ foreach (var item in valori)
+ {
+ answ += string.Format("{0}|{1}
", item.Key, item.Value);
+ }
+ }
+ catch
+ { }
+ }
+ stopWatch.Stop();
+ // Get the elapsed time as a TimeSpan value.
+ TimeSpan ts = stopWatch.Elapsed;
+ // accodo tempo!
+ answ += string.Format("
Elapsed: {0}ms", ts.TotalMilliseconds);
+ // ritorno
+ return answ;
}
- catch
- { }
- }
- stopWatch.Stop();
- // Get the elapsed time as a TimeSpan value.
- TimeSpan ts = stopWatch.Elapsed;
- // accodo tempo!
- answ += string.Format("
Elapsed: {0}ms", ts.TotalMilliseconds);
- // ritorno
- return answ;
- }
- // GET BENCH/RSETUP/100
- public string RSETUP(int? id)
- {
- string answ = "ND";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- // se id nullo --> KO!
- if (id == null)
- {
- answ = "KO";
- }
- else
- {
- string chiave;
- KeyValuePair[] valori = new KeyValuePair[2];
- try
+
+ // GET BENCH/fSMI/18?idxMS=1&valore=1
+ public string fSMI(int? id, int? idxMS, int? valore)
{
- // salvo il datasetet come insieme di hash in redis...
- for (int i = 0; i < id; i++)
- {
- chiave = string.Format("test:{0}", i);
- valori[0] = new KeyValuePair("numero", i.ToString());
- valori[1] = new KeyValuePair("doppio", (i * 2).ToString());
- memLayer.ML.redSaveHash(chiave, valori);
- }
- answ = "OK";
+ string answ = "ND";
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ // se id nullo --> KO!
+ if (id == null)
+ {
+ answ = "KO";
+ }
+ else
+ {
+ // recupero dati x sapere quale famiglia SMI è necessaria e quale stato / segnale si sia ricevuto
+ int idxFamIn = Convert.ToInt32(id);
+ int idxMicroStato = Convert.ToInt32(idxMS);
+ int valIOB = Convert.ToInt32(valore);
+ // recupero microstato macchina da chiave relativa
+ answ = "";
+ try
+ {
+ // verifico se ci sia in memoria tab della fam macchina relativa (sennò carico)
+ string fiHASH = DataLayer.hSMI(idxFamIn);
+ string outVal = "";
+ bool trovato = memLayer.ML.redHashPresentSz(fiHASH);
+ if (!trovato)
+ {
+ // ricarico tabella!
+ KeyValuePair[] valori = DataLayerObj.mTabSMI(idxFamIn);
+ answ = string.Format("Ricaricata SMI per famiglia {0}
", fiHASH);
+ }
+ answ += string.Format("Trovata {0} Hash per {1}
", memLayer.ML.redCountKey(fiHASH), fiHASH);
+ // recupero singolo valore (stringa) x chiave
+ outVal = DataLayerObj.valoreSMI(idxFamIn, idxMicroStato, valIOB);
+ // mostro output
+ answ += string.Format("idxFamIN: {0} | idxMS: {1} | valIOB: {2} | out: {3}
", idxFamIn, idxMicroStato, valIOB, outVal);
+ }
+ catch
+ { }
+ }
+ stopWatch.Stop();
+ // Get the elapsed time as a TimeSpan value.
+ TimeSpan ts = stopWatch.Elapsed;
+ // accodo tempo!
+ answ += string.Format("
Total Time Elapsed: {0}ms", ts.TotalMilliseconds);
+ // ritorno
+ return answ;
}
- catch
- { }
- }
- stopWatch.Stop();
- // Get the elapsed time as a TimeSpan value.
- TimeSpan ts = stopWatch.Elapsed;
- // accodo tempo!
- answ += string.Format("
Elapsed: {0}ms", ts.TotalMilliseconds);
- // ritorno
- return answ;
- }
- // GET BENCH/RSH/100
- public string RSH(int? id)
- {
- string answ = "ND";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- // se id nullo --> KO!
- if (id == null)
- {
- answ = "KO";
- }
- else
- {
- answ = "";
- string chiave;
- KeyValuePair[] valori = new KeyValuePair[2];
- try
+
+ // GET: IOB (è un check alive)
+ public string Index()
{
- // ora restituisco record completo dell'hash con ID indicato
- chiave = string.Format("test:{0}", id);
- valori = memLayer.ML.redGetHash(chiave);
- foreach (var item in valori)
- {
- answ += string.Format("{0}|{1}
", item.Key, item.Value);
- }
+ return "OK";
}
- catch
- { }
- }
- stopWatch.Stop();
- // Get the elapsed time as a TimeSpan value.
- TimeSpan ts = stopWatch.Elapsed;
- // accodo tempo!
- answ += string.Format("
Elapsed: {0}ms", ts.TotalMilliseconds);
- // ritorno
- return answ;
- }
- // GET BENCH/DTMAC/SIMUL_01
- public string DTMAC(string id)
- {
- string answ = "ND";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- // se id nullo --> KO!
- if (id == null)
- {
- answ = "KO";
- }
- else
- {
- answ = "";
- try
+
+ // GET BENCH/INSEN/2004
+ public string INSEN(string id)
{
- Dictionary valori = DataLayerObj.mDatiMacchine(id);
- foreach (var item in valori)
- {
- answ += string.Format("{0}|{1}
", item.Key, item.Value);
- }
+ string answ = "ND";
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ // se id nullo --> KO!
+ if (id == null)
+ {
+ answ = "KO";
+ }
+ else
+ {
+ // recupero microstato macchina da chiave relativa
+ answ = "";
+ try
+ {
+ answ += string.Format("Macchina {0}, insEnabled {1}
", id, DataLayerObj.insEnab(id));
+ }
+ catch
+ { }
+ }
+ stopWatch.Stop();
+ // Get the elapsed time as a TimeSpan value.
+ TimeSpan ts = stopWatch.Elapsed;
+ // accodo tempo!
+ answ += string.Format("
Total Time Elapsed: {0}ms", ts.TotalMilliseconds);
+ // ritorno
+ return answ;
}
- catch
- { }
- }
- stopWatch.Stop();
- // Get the elapsed time as a TimeSpan value.
- TimeSpan ts = stopWatch.Elapsed;
- // accodo tempo!
- answ += string.Format("
Elapsed: {0}ms", ts.TotalMilliseconds);
- // ritorno
- return answ;
- }
- // GET BENCH/CNTKEY/test
- public string CNTKEY(string id)
- {
- string answ = "ND";
- if (id == null) id = "";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- // conto quanti oggetti ho in memoria REDIS...
- string groupHash = ""; // DataLayer.mHash("");
- if (id.Length > 0)
- {
- groupHash += id + ":";
- }
- groupHash += "*";
- answ = string.Format("Trovate {0} Hash per {1}", memLayer.ML.redCountKey(groupHash), groupHash);
- stopWatch.Stop();
- // Get the elapsed time as a TimeSpan value.
- TimeSpan ts = stopWatch.Elapsed;
- // accodo tempo!
- answ += string.Format("
Elapsed: {0}ms", ts.TotalMilliseconds);
- // ritorno
- return answ;
- }
- // GET BENCH/tSMI/60
- public string tSMI(int? id)
- {
- string answ = "ND";
- long splitTime = 0;
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- // se id nullo --> KO!
- if (id == null)
- {
- answ = "KO";
- }
- else
- {
- int idxFamIn = Convert.ToInt32(id);
- answ = "";
- try
+
+ // GET BENCH/RCLEAN/100
+ public string RCLEAN(int? id)
{
- KeyValuePair[] valori = DataLayerObj.mTabSMI(idxFamIn);
- splitTime = stopWatch.ElapsedMilliseconds;
- foreach (var item in valori)
- {
- answ += string.Format("{0}|{1}
", item.Key, item.Value);
- }
+ string answ = "ND";
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ // se id nullo --> KO!
+ if (id == null)
+ {
+ answ = "KO";
+ }
+ else
+ {
+ string chiave;
+ KeyValuePair[] valori = new KeyValuePair[2];
+ try
+ {
+ // svuoto i precedenti hash... CICLO!
+ for (int i = 0; i < id; i++)
+ {
+ chiave = string.Format("test:{0}", i);
+ memLayer.ML.redDelKey(chiave);
+ }
+ answ = "OK";
+ }
+ catch
+ { }
+ }
+ stopWatch.Stop();
+ // Get the elapsed time as a TimeSpan value.
+ TimeSpan ts = stopWatch.Elapsed;
+ // accodo tempo!
+ answ += string.Format("
Elapsed: {0}ms", ts.TotalMilliseconds);
+ // ritorno
+ return answ;
}
- catch
- { }
- }
- stopWatch.Stop();
- // Get the elapsed time as a TimeSpan value.
- TimeSpan ts = stopWatch.Elapsed;
- // accodo tempo!
- answ += string.Format("
ReadTime: {0}ms
Total Time Elapsed: {1}ms", splitTime, ts.TotalMilliseconds);
- // ritorno
- return answ;
- }
- // GET BENCH/fSMI/18?idxMS=1&valore=1
- public string fSMI(int? id, int? idxMS, int? valore)
- {
- string answ = "ND";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- // se id nullo --> KO!
- if (id == null)
- {
- answ = "KO";
- }
- else
- {
- // recupero dati x sapere quale famiglia SMI è necessaria e quale stato / segnale si sia ricevuto
- int idxFamIn = Convert.ToInt32(id);
- int idxMicroStato = Convert.ToInt32(idxMS);
- int valIOB = Convert.ToInt32(valore);
- // recupero microstato macchina da chiave relativa
- answ = "";
- try
+
+ // GET BENCH/RSETUP/100
+ public string RSETUP(int? id)
{
- // verifico se ci sia in memoria tab della fam macchina relativa (sennò carico)
- string fiHASH = DataLayer.hSMI(idxFamIn);
- string outVal = "";
- bool trovato = memLayer.ML.redHashPresentSz(fiHASH);
- if (!trovato)
- {
- // ricarico tabella!
- KeyValuePair[] valori = DataLayerObj.mTabSMI(idxFamIn);
- answ = string.Format("Ricaricata SMI per famiglia {0}
", fiHASH);
- }
- answ += string.Format("Trovata {0} Hash per {1}
", memLayer.ML.redCountKey(fiHASH), fiHASH);
- // recupero singolo valore (stringa) x chiave
- outVal = DataLayerObj.valoreSMI(idxFamIn, idxMicroStato, valIOB);
- // mostro output
- answ += string.Format("idxFamIN: {0} | idxMS: {1} | valIOB: {2} | out: {3}
", idxFamIn, idxMicroStato, valIOB, outVal);
+ string answ = "ND";
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ // se id nullo --> KO!
+ if (id == null)
+ {
+ answ = "KO";
+ }
+ else
+ {
+ string chiave;
+ KeyValuePair[] valori = new KeyValuePair[2];
+ try
+ {
+ // salvo il datasetet come insieme di hash in redis...
+ for (int i = 0; i < id; i++)
+ {
+ chiave = string.Format("test:{0}", i);
+ valori[0] = new KeyValuePair("numero", i.ToString());
+ valori[1] = new KeyValuePair("doppio", (i * 2).ToString());
+ memLayer.ML.redSaveHash(chiave, valori);
+ }
+ answ = "OK";
+ }
+ catch
+ { }
+ }
+ stopWatch.Stop();
+ // Get the elapsed time as a TimeSpan value.
+ TimeSpan ts = stopWatch.Elapsed;
+ // accodo tempo!
+ answ += string.Format("
Elapsed: {0}ms", ts.TotalMilliseconds);
+ // ritorno
+ return answ;
}
- catch
- { }
- }
- stopWatch.Stop();
- // Get the elapsed time as a TimeSpan value.
- TimeSpan ts = stopWatch.Elapsed;
- // accodo tempo!
- answ += string.Format("
Total Time Elapsed: {0}ms", ts.TotalMilliseconds);
- // ritorno
- return answ;
- }
- // GET BENCH/INSEN/2004
- public string INSEN(string id)
- {
- string answ = "ND";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- // se id nullo --> KO!
- if (id == null)
- {
- answ = "KO";
- }
- else
- {
- // recupero microstato macchina da chiave relativa
- answ = "";
- try
+
+ // GET BENCH/RSH/100
+ public string RSH(int? id)
{
- answ += string.Format("Macchina {0}, insEnabled {1}
", id, DataLayerObj.insEnab(id));
+ string answ = "ND";
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ // se id nullo --> KO!
+ if (id == null)
+ {
+ answ = "KO";
+ }
+ else
+ {
+ answ = "";
+ string chiave;
+ KeyValuePair[] valori = new KeyValuePair[2];
+ try
+ {
+ // ora restituisco record completo dell'hash con ID indicato
+ chiave = string.Format("test:{0}", id);
+ valori = memLayer.ML.redGetHash(chiave);
+ foreach (var item in valori)
+ {
+ answ += string.Format("{0}|{1}
", item.Key, item.Value);
+ }
+ }
+ catch
+ { }
+ }
+ stopWatch.Stop();
+ // Get the elapsed time as a TimeSpan value.
+ TimeSpan ts = stopWatch.Elapsed;
+ // accodo tempo!
+ answ += string.Format("
Elapsed: {0}ms", ts.TotalMilliseconds);
+ // ritorno
+ return answ;
}
- catch
- { }
- }
- stopWatch.Stop();
- // Get the elapsed time as a TimeSpan value.
- TimeSpan ts = stopWatch.Elapsed;
- // accodo tempo!
- answ += string.Format("
Total Time Elapsed: {0}ms", ts.TotalMilliseconds);
- // ritorno
- return answ;
+
+ // GET BENCH/tSMI/60
+ public string tSMI(int? id)
+ {
+ string answ = "ND";
+ long splitTime = 0;
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ // se id nullo --> KO!
+ if (id == null)
+ {
+ answ = "KO";
+ }
+ else
+ {
+ int idxFamIn = Convert.ToInt32(id);
+ answ = "";
+ try
+ {
+ KeyValuePair[] valori = DataLayerObj.mTabSMI(idxFamIn);
+ splitTime = stopWatch.ElapsedMilliseconds;
+ foreach (var item in valori)
+ {
+ answ += string.Format("{0}|{1}
", item.Key, item.Value);
+ }
+ }
+ catch
+ { }
+ }
+ stopWatch.Stop();
+ // Get the elapsed time as a TimeSpan value.
+ TimeSpan ts = stopWatch.Elapsed;
+ // accodo tempo!
+ answ += string.Format("
ReadTime: {0}ms
Total Time Elapsed: {1}ms", splitTime, ts.TotalMilliseconds);
+ // ritorno
+ return answ;
+ }
+
+ #endregion Public Methods
+
+ #region Private Fields
+
+ ///
+ /// Oggetto datalayer specifico
+ ///
+ private DataLayer DataLayerObj = new DataLayer();
+
+ #endregion Private Fields
}
- }
}
\ No newline at end of file
diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs
index e561d670..5cc020d5 100644
--- a/MP-IO/Controllers/IOBController.cs
+++ b/MP-IO/Controllers/IOBController.cs
@@ -222,9 +222,6 @@ namespace MP_IO.Controllers
return answ;
}
-
- protected static DataLayer DataLayerMan = new DataLayer();
-
///
/// Processa una chiamata POST per l'invio di un array Json di oggetti input (EVENTI)
/// POST: IOB/evListJson/SIMUL_03
@@ -2599,6 +2596,12 @@ namespace MP_IO.Controllers
#endregion Public Methods
+ #region Protected Fields
+
+ protected static DataLayer DataLayerMan = new DataLayer();
+
+ #endregion Protected Fields
+
#region Private Methods
///
@@ -2677,7 +2680,7 @@ namespace MP_IO.Controllers
answ = "NO";
}
// leggo parametri correnti...
- DateTime adesso= DateTime.Now;
+ DateTime adesso = DateTime.Now;
try
{
List currParams = DataLayerObj.getCurrObjItems(id);
@@ -2709,9 +2712,8 @@ namespace MP_IO.Controllers
else
{
// richiesto 10 sec prima...
- trovato.lastRequest= adesso.AddSeconds(-10);
+ trovato.lastRequest = adesso.AddSeconds(-10);
}
-
}
// altrimenti AGGIUNGO (READ ONLY)...
else
@@ -2745,4 +2747,4 @@ namespace MP_IO.Controllers
#endregion Private Methods
}
-}
+}
\ No newline at end of file
diff --git a/MP-IO/Interfaces/IBENCHService.cs b/MP-IO/Interfaces/IBENCHService.cs
index 19bd8abf..921b439d 100644
--- a/MP-IO/Interfaces/IBENCHService.cs
+++ b/MP-IO/Interfaces/IBENCHService.cs
@@ -2,11 +2,33 @@ namespace MP_IO.Interfaces
{
public interface IBENCHService
{
+ #region Public Methods
+
+ ///
+ /// GET BENCH/CNTKEY/test
+ ///
+ string CNTKEY(string id);
+
+ ///
+ /// GET BENCH/DTMAC/SIMUL_01
+ ///
+ string DTMAC(string id);
+
+ ///
+ /// GET BENCH/fSMI/18?idxMS=1&valore=1
+ ///
+ string fSMI(int? id, int? idxMS, int? valore);
+
///
/// GET: IOB (è un check alive)
///
string Index();
+ ///
+ /// GET BENCH/INSEN/2004
+ ///
+ string INSEN(string id);
+
///
/// GET BENCH/RCLEAN/100
///
@@ -22,29 +44,11 @@ namespace MP_IO.Interfaces
///
string RSH(int? id);
- ///
- /// GET BENCH/DTMAC/SIMUL_01
- ///
- string DTMAC(string id);
-
- ///
- /// GET BENCH/CNTKEY/test
- ///
- string CNTKEY(string id);
-
///
/// GET BENCH/tSMI/60
///
string tSMI(int? id);
- ///
- /// GET BENCH/fSMI/18?idxMS=1&valore=1
- ///
- string fSMI(int? id, int? idxMS, int? valore);
-
- ///
- /// GET BENCH/INSEN/2004
- ///
- string INSEN(string id);
+ #endregion Public Methods
}
-}
+}
\ No newline at end of file
diff --git a/MP-IO/Interfaces/IHomeService.cs b/MP-IO/Interfaces/IHomeService.cs
index f97aff56..8a1aa979 100644
--- a/MP-IO/Interfaces/IHomeService.cs
+++ b/MP-IO/Interfaces/IHomeService.cs
@@ -1,13 +1,16 @@
-
using System.Web.Mvc;
namespace MP_IO.Interfaces
{
public interface IHomeService
{
+ #region Public Methods
+
///
/// GET: Home
///
RedirectResult Index();
+
+ #endregion Public Methods
}
-}
+}
\ No newline at end of file
diff --git a/MP-IO/Interfaces/IIOBService.cs b/MP-IO/Interfaces/IIOBService.cs
index 5cfb0d9e..56f2b59b 100644
--- a/MP-IO/Interfaces/IIOBService.cs
+++ b/MP-IO/Interfaces/IIOBService.cs
@@ -6,6 +6,8 @@ namespace MP_IO.Interfaces
///
public interface IIOBService
{
+ #region Public Methods
+
///
///
///
@@ -360,6 +362,7 @@ namespace MP_IO.Interfaces
///
///
string getOdlAtDate(string id, string dateRif);
+
string getOptPar(string id);
///
@@ -369,7 +372,9 @@ namespace MP_IO.Interfaces
///
///
string getPODL(string id, int idxPODL);
+
string getPOdlAct(string id);
+
string getPOdlNext(string id);
///
@@ -378,33 +383,63 @@ namespace MP_IO.Interfaces
///
///
string getTask2Exe(string id);
+
string getXdlNum(string id, string CodXdl = "");
+
string Index();
+
string input(string id, string valore, string dtEve, string dtCurr, string cnt);
+
string liveJson(string id);
+
string liveRec(string id, string liveData);
+
string rawTransfJson(string id);
+
string remOptPar(string id, string pName);
+
string remTask2Exe(string id, string taskName);
+
string resetCurrODL(string id);
+
string saveConf(string id);
+
string saveConfYaml(string id);
+
string saveDataItems(string id);
+
string saveMachineIobConf(string id);
+
string savePzCountInc(string id, string qty);
+
string savePzCountIncAtDate(string id, string qty, string dtEve = "", string dtCurr = "");
+
string sendAlarmBankUpdate(string id, string memAddr, int index, int currStatus);
+
string sendReboot(string id, string mac);
+
string sendRebootGateway(string GWIP);
+
string setCounter(string id, string counter);
+
string setM2IOB(string id, string IOB_name);
+
string setObjItems(string id);
+
string setRedisHashDict(string id);
+
string slog(string id);
+
string takeFlogSnapshot(string id);
+
string ulog(string id, string flux, string valore, string dtEve, string dtCurr, string cnt, string matrOpr, string label, string valNum);
+
string ulogJson(string id);
+
string uploadFile(string id);
+
string upsertObjItems(string id);
+
+ #endregion Public Methods
}
-}
+}
\ No newline at end of file