diff --git a/MP-IO/Web.config b/MP-IO/Web.config
index 1d6cb252..ad0945c9 100644
--- a/MP-IO/Web.config
+++ b/MP-IO/Web.config
@@ -25,6 +25,8 @@
+
+
diff --git a/MapoDb/DataLayer.cs b/MapoDb/DataLayer.cs
index ddef6e8a..bb2880de 100644
--- a/MapoDb/DataLayer.cs
+++ b/MapoDb/DataLayer.cs
@@ -808,7 +808,7 @@ namespace MapoDb
/// Processa registrazione di un counter x una data macchina IOB
///
///
- /// Dati live nel formato chiave1|valore1#chiave2|valore2#chiave3|valore3
+ /// contapezzi
///
public static string saveCounter(string idxMacchina, string counter)
{
@@ -820,7 +820,7 @@ namespace MapoDb
if (memLayer.ML.CRB("IOB_RedEnab"))
{
// conto la richiesta nel contatore REDIS
- long nCall = memLayer.ML.setRCntI(mHash("COUNT:pCall:setCounter"));
+ long nCall = memLayer.ML.setRCntI(mHash("COUNT:pCall:saveCounter"));
//... se == nCall2Log scrivo su log e resetto
long nCall2Log = memLayer.ML.cdvi("nCall2Log");
if (nCall >= nCall2Log)
@@ -828,11 +828,10 @@ namespace MapoDb
// loggo
logger.lg.scriviLog(string.Format("saveCounter: effettuate {0} call", nCall), tipoLog.INFO);
// resetto!
- memLayer.ML.resetRCnt(mHash("COUNT:pCall:setCounter"));
+ memLayer.ML.resetRCnt(mHash("COUNT:pCall:saveCounter"));
}
}
string answ = "";
- DateTime dataOraEvento = DateTime.Now;
// inizio processing vero e proprio INPUT...
if (idxMacchina != null && counter != null)
{
@@ -864,6 +863,58 @@ namespace MapoDb
}
return answ;
}
+ ///
+ /// Processa registrazione di un counter x una data macchina IOB
+ ///
+ ///
+ /// cod ODL in produzione, se "" --> non c'è...
+ ///
+ public static string saveCurrODL(string idxMacchina, string currODL)
+ {
+ if (currODL == null)
+ {
+ throw new ArgumentNullException(nameof(currODL));
+ }
+ // registro conteggio impiego chiamate REDIS
+ if (memLayer.ML.CRB("IOB_RedEnab"))
+ {
+ // conto la richiesta nel contatore REDIS
+ long nCall = memLayer.ML.setRCntI(mHash("COUNT:pCall:saveCurrODL"));
+ //... se == nCall2Log scrivo su log e resetto
+ long nCall2Log = memLayer.ML.cdvi("nCall2Log");
+ if (nCall >= nCall2Log)
+ {
+ // loggo
+ logger.lg.scriviLog(string.Format("saveCurrODL: effettuate {0} call", nCall), tipoLog.INFO);
+ // resetto!
+ memLayer.ML.resetRCnt(mHash("COUNT:pCall:saveCurrODL"));
+ }
+ }
+ string answ = "";
+ // inizio processing vero e proprio INPUT...
+ if (idxMacchina != null && currODL != null)
+ {
+ if (idxMacchina != "" && currODL != "")
+ {
+ memLayer.ML.setRSV(currODLHash(idxMacchina), currODL, memLayer.ML.CRI("currOdlCacheDur"));
+ // registro in risposta che è andato tutto bene...
+ answ = "OK";
+ }
+ else
+ {
+ string errore = "Errore: parametri macchina/currODL vuoti";
+ logger.lg.scriviLog(errore, tipoLog.ERROR);
+ answ = errore;
+ }
+ }
+ else
+ {
+ string errore = "Errore: mancano parametri macchina/currODL";
+ logger.lg.scriviLog(errore, tipoLog.ERROR);
+ answ = errore;
+ }
+ return answ;
+ }
#region definizioni hash x REDIS
@@ -901,12 +952,21 @@ namespace MapoDb
/// Hash dati COUNTER x la macchina specificata
///
///
- ///
+ ///
public static string pzCountHash(string idxMacchina)
{
return mHash(string.Format("PzCount:{0}", idxMacchina));
}
///
+ /// Hash dati Current ODL x la macchina specificata
+ ///
+ ///
+ ///
+ public static string currODLHash(string idxMacchina)
+ {
+ return mHash(string.Format("CurrODL:{0}", idxMacchina));
+ }
+ ///
/// Hash dati LIVE x la macchina specificata
///
///
@@ -1237,6 +1297,48 @@ namespace MapoDb
return answ;
}
///
+ /// Restituisce il valore dell'ODL corrente (ODL deve esserci per gestione contapezzi, senza ODL NO invio/gestione ODL)
+ ///
+ ///
+ ///
+ public static string currODL(string idxMacchina)
+ {
+ string answ = "";
+ string rCall = "";
+ if (memLayer.ML.CRB("IOB_RedEnab"))
+ {
+
+ // conto la richiesta nel contatore REDIS
+ long nCall = memLayer.ML.setRCntI(mHash("COUNT:pCall:hasODL"));
+ //... se == nCall2Log scrivo su log e resetto
+ long nCall2Log = memLayer.ML.cdvi("nCall2Log");
+ if (nCall >= nCall2Log)
+ {
+ // loggo
+ logger.lg.scriviLog(string.Format("hasODL: effettuate {0} call", nCall), tipoLog.INFO);
+ // resetto!
+ memLayer.ML.resetRCnt(mHash("COUNT:pCall:hasODL"));
+ }
+ try
+ {
+ rCall = memLayer.ML.getRSV(currODLHash(idxMacchina));
+ if (rCall != "" && rCall != null)
+ {
+ answ = rCall;
+ }
+ else
+ {
+ answ = MapoDb.obj.currODL(idxMacchina);
+ // salvo in redis...
+ saveCurrODL(idxMacchina, answ);
+ }
+ }
+ catch
+ { }
+ }
+ return answ;
+ }
+ ///
/// Restituisce il valore booleano se la macchina sia abilitata all'inserimento COMPLETO nel Signal Log
///
///
diff --git a/MapoDb/MapoDb.cs b/MapoDb/MapoDb.cs
index e0e71a8d..257546c7 100644
--- a/MapoDb/MapoDb.cs
+++ b/MapoDb/MapoDb.cs
@@ -90,8 +90,8 @@ namespace MapoDb
taDatiMacch = new DS_applicazioneTableAdapters.DatiMacchineTableAdapter();
taMSM = new DS_applicazioneTableAdapters.MicroStatoMacchinaTableAdapter();
taMSFD = new DS_applicazioneTableAdapters.MSFDTableAdapter();
-
taDatiMacchine = new DS_ProdTempiTableAdapters.DatiMacchineTableAdapter();
+ taODL = new DS_ProdTempiTableAdapters.ODLTableAdapter();
taTCRilevati = new DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter();
}
///
@@ -116,6 +116,7 @@ namespace MapoDb
taMSM.Connection.ConnectionString = _connectionString;
taMSFD.Connection.ConnectionString = _connectionString;
taDatiMacchine.Connection.ConnectionString = _connectionString;
+ taODL.Connection.ConnectionString = _connectionString;
taTCRilevati.Connection.ConnectionString = _connectionString;
}
///
@@ -275,9 +276,9 @@ namespace MapoDb
public DS_applicazioneTableAdapters.DatiMacchineTableAdapter taDatiMacch;
public DS_applicazioneTableAdapters.MicroStatoMacchinaTableAdapter taMSM;
public DS_applicazioneTableAdapters.MSFDTableAdapter taMSFD;
-
// area tempi ciclo
public DS_ProdTempiTableAdapters.DatiMacchineTableAdapter taDatiMacchine;
+ public DS_ProdTempiTableAdapters.ODLTableAdapter taODL;
public DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter taTCRilevati;
#endregion
@@ -406,6 +407,26 @@ namespace MapoDb
return answ;
}
///
+ /// restituisce valore dell'ODL attivo (iniziato e NON concluso)
+ ///
+ ///
+ ///
+ public string currODL(string idxMacchina)
+ {
+ string answ = "";
+ var tab = taODL.getByMacchinaAperto(idxMacchina);
+ if (tab.Rows.Count > 0)
+ {
+ try
+ {
+ answ = taODL.getByMacchinaAperto(idxMacchina)[0].IdxODL.ToString();
+ }
+ catch
+ { }
+ }
+ return answ;
+ }
+ ///
/// restituisce boolean se la macchina sia abilitata x registrazione segnali in input (tab DatiMacchine)
///
///