modifiche x evitare se possibile sovrapposizioni in fase lettura/scrittura DB x MP/IO + altro update test BENCH x IO
This commit is contained in:
@@ -456,6 +456,8 @@ namespace MapoDb
|
||||
// continuo col resto
|
||||
try
|
||||
{
|
||||
// scrivo keep alive!!! (se encessario, altrimenti è in cache...)
|
||||
MapoDb.obj.scriviKeepAlive(idxMacchina, DateTime.Now);
|
||||
// ora processo e salvo il valore del microstato...
|
||||
MapoDb.obj.checkMicroStato(idxMacchina, valore, dataOraEvento, contatore);
|
||||
answ = "OK"; // registro in risposta che è andato tutto bene...
|
||||
|
||||
+38
-34
@@ -74,22 +74,23 @@ namespace MapoDb
|
||||
/// </summary>
|
||||
private void AvviaTabAdapt()
|
||||
{
|
||||
taEvList = new global::MapoDb.DS_applicazioneTableAdapters.EventListTableAdapter();
|
||||
taDiario = new global::MapoDb.DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter();
|
||||
taAnagSt = new global::MapoDb.DS_applicazioneTableAdapters.AnagraficaStatiTableAdapter();
|
||||
taAnagEv = new global::MapoDb.DS_applicazioneTableAdapters.AnagraficaEventiTableAdapter();
|
||||
taMacchine = new global::MapoDb.DS_applicazioneTableAdapters.MacchineTableAdapter();
|
||||
taTranEv = new global::MapoDb.DS_applicazioneTableAdapters.TransizioneEventiTableAdapter();
|
||||
taTranSt = new global::MapoDb.DS_applicazioneTableAdapters.TransizioneStatiTableAdapter();
|
||||
taStatoMacchine = new global::MapoDb.DS_applicazioneTableAdapters.StatoMacchineTableAdapter();
|
||||
taKeepAlive = new global::MapoDb.DS_applicazioneTableAdapters.KeepAliveTableAdapter();
|
||||
taRRL = new global::MapoDb.DS_applicazioneTableAdapters.RemoteRebootLogTableAdapter();
|
||||
taTransIngr = new global::MapoDb.DS_applicazioneTableAdapters.TransizioneIngressiTableAdapter();
|
||||
taAnOpr = new global::MapoDb.DS_applicazioneTableAdapters.AnagraficaOperatoriTableAdapter();
|
||||
taDatiMacch = new global::MapoDb.DS_applicazioneTableAdapters.DatiMacchineTableAdapter();
|
||||
taMSM = new global::MapoDb.DS_applicazioneTableAdapters.MicroStatoMacchinaTableAdapter();
|
||||
taEvList = new DS_applicazioneTableAdapters.EventListTableAdapter();
|
||||
taDiario = new DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter();
|
||||
taAnagSt = new DS_applicazioneTableAdapters.AnagraficaStatiTableAdapter();
|
||||
taAnagEv = new DS_applicazioneTableAdapters.AnagraficaEventiTableAdapter();
|
||||
taMacchine = new DS_applicazioneTableAdapters.MacchineTableAdapter();
|
||||
taTranEv = new DS_applicazioneTableAdapters.TransizioneEventiTableAdapter();
|
||||
taTranSt = new DS_applicazioneTableAdapters.TransizioneStatiTableAdapter();
|
||||
taStatoMacchine = new DS_applicazioneTableAdapters.StatoMacchineTableAdapter();
|
||||
taKeepAlive = new DS_applicazioneTableAdapters.KeepAliveTableAdapter();
|
||||
taRRL = new DS_applicazioneTableAdapters.RemoteRebootLogTableAdapter();
|
||||
taTransIngr = new DS_applicazioneTableAdapters.TransizioneIngressiTableAdapter();
|
||||
taAnOpr = new DS_applicazioneTableAdapters.AnagraficaOperatoriTableAdapter();
|
||||
taDatiMacch = new DS_applicazioneTableAdapters.DatiMacchineTableAdapter();
|
||||
taMSM = new DS_applicazioneTableAdapters.MicroStatoMacchinaTableAdapter();
|
||||
|
||||
taTCRilevati = new global::MapoDb.DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter();
|
||||
taDatiMacchine = new DS_ProdTempiTableAdapters.DatiMacchineTableAdapter();
|
||||
taTCRilevati = new DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter();
|
||||
}
|
||||
/// <summary>
|
||||
/// forza la connString x i vari table adapters
|
||||
@@ -112,6 +113,7 @@ namespace MapoDb
|
||||
taDatiMacch.Connection.ConnectionString = _connectionString;
|
||||
taMSM.Connection.ConnectionString = _connectionString;
|
||||
|
||||
taDatiMacchine.Connection.ConnectionString = _connectionString;
|
||||
taTCRilevati.Connection.ConnectionString = _connectionString;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -292,6 +294,7 @@ namespace MapoDb
|
||||
public DS_applicazioneTableAdapters.MicroStatoMacchinaTableAdapter taMSM;
|
||||
|
||||
// area tempi ciclo
|
||||
public DS_ProdTempiTableAdapters.DatiMacchineTableAdapter taDatiMacchine;
|
||||
public DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter taTCRilevati;
|
||||
|
||||
#endregion
|
||||
@@ -467,8 +470,6 @@ namespace MapoDb
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt]{2}---------------------------{2}Richiesta verifica INPUT per Macchina {0}, seriale {1}", idxMacchina, valore, Environment.NewLine), tipoLog.INFO);
|
||||
}
|
||||
// scrivo keep alive!
|
||||
scriviKeepAlive(idxMacchina, DateTime.Now);
|
||||
// formatto output
|
||||
inputComando answ = new inputComando();
|
||||
DS_applicazione.TransizioneIngressiDataTable TabTransIn;
|
||||
@@ -479,12 +480,13 @@ namespace MapoDb
|
||||
// recupero CodArticolo corretto
|
||||
try
|
||||
{
|
||||
DataLayer.obj.taDatiConfermati = new DS_ProdTempiTableAdapters.DatiConfermatiTableAdapter();
|
||||
CodArticolo = DataLayer.obj.taDatiMacchine.getByIdx(Convert.ToInt32(idxMacchina))[0].CodArticolo_A;
|
||||
// 2017.07.10 forzo init x errori "sovrapposizioni"
|
||||
taDatiMacchine = new DS_ProdTempiTableAdapters.DatiMacchineTableAdapter();
|
||||
CodArticolo = taDatiMacchine.getByIdx(Convert.ToInt32(idxMacchina))[0].CodArticolo_A;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_4] - Eccezione in recupero CodArticolo:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_4a] - Eccezione in recupero CodArticolo:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
// recupero next microstato
|
||||
//int? valINT = Convert.ToInt32(valore);
|
||||
@@ -502,7 +504,7 @@ namespace MapoDb
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt] - Eccezione in recupero riga Trans ingressi per idxMacchina {3} e valore {2}:{0}{1}", Environment.NewLine, exc, valINT, idxMacchina), tipoLog.EXCEPTION);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_5a] - - Eccezione in recupero riga Trans ingressi per idxMacchina {3} e valore {2}:{0}{1}", Environment.NewLine, exc, valINT, idxMacchina), tipoLog.EXCEPTION);
|
||||
}
|
||||
int _logLevel = memLayer.ML.confReadInt("_logLevel");
|
||||
// effettuo update vari
|
||||
@@ -512,7 +514,7 @@ namespace MapoDb
|
||||
{
|
||||
if (_logLevel > 5)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt] - Salvo Update Microstato:{0}macchina: {1} | valore seriale: {2} | next micro stato: {3}", Environment.NewLine, idxMacchina, valINT, rigaTransIn.next_IdxMicroStato), tipoLog.INFO);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_6a] - Salvo Update Microstato:{0}macchina: {1} | valore seriale: {2} | next micro stato: {3}", Environment.NewLine, idxMacchina, valINT, rigaTransIn.next_IdxMicroStato), tipoLog.INFO);
|
||||
}
|
||||
// 2017.06.09 forzo init x errori "sovrapposizioni"
|
||||
taMSM = new DS_applicazioneTableAdapters.MicroStatoMacchinaTableAdapter();
|
||||
@@ -523,19 +525,19 @@ namespace MapoDb
|
||||
{
|
||||
if (_logLevel > 5)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt] - Salvo evento:{0}macchina: {1} | tipoEvento: {2} | CodArticolo: {3} | contatore: {4} | valore: {5}", Environment.NewLine, idxMacchina, rigaTransIn.IdxTipoEvento, CodArticolo, contatore, valore), tipoLog.INFO);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_7a] - Salvo evento:{0}macchina: {1} | tipoEvento: {2} | CodArticolo: {3} | contatore: {4} | valore: {5}", Environment.NewLine, idxMacchina, rigaTransIn.IdxTipoEvento, CodArticolo, contatore, valore), tipoLog.INFO);
|
||||
}
|
||||
string valEsteso = string.Format("[{0}] {1}", contatore.PadLeft(3, '0'), valore);
|
||||
answ = scriviRigaEvento(idxMacchina, rigaTransIn.IdxTipoEvento, CodArticolo, valEsteso, 0, "-", dtEve, DateTime.Now); // aggiunto contatore!
|
||||
if (_logLevel > 5)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt] - Macchina {0} | seriale(INT) {1} | valEsteso {3} | answ {4}{2}---------------------------{2}", idxMacchina, valINT, Environment.NewLine, valEsteso, answ), tipoLog.INFO);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_a] - Macchina {0} | seriale(INT) {1} | valEsteso {3} | answ {4}{2}---------------------------{2}", idxMacchina, valINT, Environment.NewLine, valEsteso, answ), tipoLog.INFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt] - Eccezione:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_8a] - Eccezione:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
@@ -553,8 +555,6 @@ namespace MapoDb
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("{2}---------------------------{2}Richiesta verifica INPUT per Macchina {0}, seriale {1}", idxMacchina, valore, Environment.NewLine), tipoLog.INFO);
|
||||
}
|
||||
// scrivo keep alive!
|
||||
scriviKeepAlive(idxMacchina, DateTime.Now);
|
||||
// formatto output
|
||||
inputComando answ = new inputComando();
|
||||
DS_applicazione.TransizioneIngressiDataTable TabTransIn;
|
||||
@@ -565,17 +565,21 @@ namespace MapoDb
|
||||
// recupero CodArticolo corretto
|
||||
try
|
||||
{
|
||||
CodArticolo = DataLayer.obj.taDatiMacchine.getByIdx(Convert.ToInt32(idxMacchina))[0].CodArticolo_A;
|
||||
// 2017.07.10 forzo init x errori "sovrapposizioni"
|
||||
taDatiMacchine = new DS_ProdTempiTableAdapters.DatiMacchineTableAdapter();
|
||||
CodArticolo = taDatiMacchine.getByIdx(Convert.ToInt32(idxMacchina))[0].CodArticolo_A;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_3] - Eccezione in recupero CodArticolo:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_4b] - Eccezione in recupero CodArticolo:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
// recupero next microstato
|
||||
//int? valINT = Convert.ToInt32(valore);
|
||||
int? valINT = 0;
|
||||
try
|
||||
{
|
||||
// 2017.06.09 forzo init x errori "sovrapposizioni"
|
||||
taTransIngr = new DS_applicazioneTableAdapters.TransizioneIngressiTableAdapter();
|
||||
valINT = int.Parse(valore, System.Globalization.NumberStyles.HexNumber);
|
||||
TabTransIn = taTransIngr.getByIdxMacchinaValore(idxMacchina, valINT);
|
||||
if (TabTransIn.Rows.Count > 0)
|
||||
@@ -585,7 +589,7 @@ namespace MapoDb
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Eccezione in recupero riga Trans ingressi per idxMacchina {3} e valore {2}:{0}{1}", Environment.NewLine, exc, valINT, idxMacchina), tipoLog.EXCEPTION);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_5b] - Eccezione in recupero riga Trans ingressi per idxMacchina {3} e valore {2}:{0}{1}", Environment.NewLine, exc, valINT, idxMacchina), tipoLog.EXCEPTION);
|
||||
}
|
||||
int _logLevel = memLayer.ML.confReadInt("_logLevel");
|
||||
// effettuo update vari
|
||||
@@ -595,7 +599,7 @@ namespace MapoDb
|
||||
{
|
||||
if (_logLevel > 5)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Salvo Update Microstato:{0}macchina: {1} | valore seriale: {2} | next micro stato: {3}", Environment.NewLine, idxMacchina, valINT, rigaTransIn.next_IdxMicroStato), tipoLog.INFO);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_6b] - Salvo Update Microstato:{0}macchina: {1} | valore seriale: {2} | next micro stato: {3}", Environment.NewLine, idxMacchina, valINT, rigaTransIn.next_IdxMicroStato), tipoLog.INFO);
|
||||
}
|
||||
// salvo nuovo microstato...
|
||||
taMSM.updateQuery(rigaTransIn.next_IdxMicroStato, dtEve, valore, idxMacchina);
|
||||
@@ -604,18 +608,18 @@ namespace MapoDb
|
||||
{
|
||||
if (_logLevel > 5)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Salvo evento:{0}macchina: {1} | tipoEvento: {2} | CodArticolo: {3}", Environment.NewLine, idxMacchina, rigaTransIn.IdxTipoEvento, CodArticolo), tipoLog.INFO);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_7b] - Salvo evento:{0}macchina: {1} | tipoEvento: {2} | CodArticolo: {3}", Environment.NewLine, idxMacchina, rigaTransIn.IdxTipoEvento, CodArticolo), tipoLog.INFO);
|
||||
}
|
||||
answ = scriviRigaEvento(idxMacchina, rigaTransIn.IdxTipoEvento, CodArticolo, valore, 0, "-", dtEve, DateTime.Now);
|
||||
if (_logLevel > 5)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Macchina {0}, seriale(INT) {1}{2}---------------------------{2}", idxMacchina, valINT, Environment.NewLine), tipoLog.INFO);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_b] -Macchina {0}, seriale(INT) {1}{2}---------------------------{2}", idxMacchina, valINT, Environment.NewLine), tipoLog.INFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Eccezione:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
logger.lg.scriviLog(string.Format("[ChkMiSt_8b] - Eccezione:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
|
||||
Reference in New Issue
Block a user