Update IOB: metodi NUOVI x counter pz (DB.MSE esplicito e fallback)

This commit is contained in:
Samuele E. Locatelli
2018-06-26 19:22:25 +02:00
parent 1558d7ebff
commit 6caa31f548
3 changed files with 69 additions and 5 deletions
Vendored
+1 -1
View File
@@ -17,7 +17,7 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=777']) {
withEnv(['NEXT_BUILD_NUMBER=779']) {
// env.versionNumber = VersionNumber(versionNumberString : '5.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '5.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO'
+23
View File
@@ -163,6 +163,29 @@ namespace MP_IO.Controllers
return answ;
}
/// <summary>
/// Recupera COUNTER x macchina dal CONTEGGIO dei TCRecorded:
///
/// GET: IOB/getCounterTCRec/5
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public string getCounterTCRec(string id)
{
string answ = "";
// !!!FARE!!! ottimizzare e leggere da DB solo ogni tot minuti e x il resto usare redis?!?
try
{
answ = DataLayer.pzCounterTC(id).ToString();
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in counter TC (get){0}{1}", Environment.NewLine, exc));
answ = "NO";
}
return answ;
}
/// <summary>
/// SALVA Counter x macchina:
///
/// GET: IOB/setCounter/5?counter=10
+45 -4
View File
@@ -1056,14 +1056,13 @@ namespace MapoDb
// 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["insEnabled"].ToLower() == "true") ? tOutShort : tOutLong;
int redDtMacTOut = (answ["insEnabled"].ToLower() == "true") ? tOutShort : tOutLong;
// salvo in redis!
memLayer.ML.redSaveHashDict(currHash, answ, redDtMacTOut);
return answ;
}
#endregion
#region gestione dati macchina
/// <summary>
@@ -1164,7 +1163,7 @@ namespace MapoDb
answ.Add("simplePallet", rigaMSFD.simplePallet.ToString());
answ.Add("palletChange", rigaMSFD.palletChange.ToString());
}
catch(Exception exc)
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in compilazione dati MSFD:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
}
@@ -1258,6 +1257,37 @@ namespace MapoDb
return answ;
}
/// <summary>
/// Restituisce il contapezzi come CONTEGGIO da TCRilevati per la macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public static int pzCounterTC(string idxMacchina)
{
int answ = -1;
if (memLayer.ML.CRB("IOB_RedEnab"))
{
// conto la richiesta nel contatore REDIS
long nCall = memLayer.ML.setRCntI(mHash("COUNT:pCall:getCounterTC"));
//... se == nCall2Log scrivo su log e resetto
long nCall2Log = memLayer.ML.cdvi("nCall2Log");
if (nCall >= nCall2Log)
{
// loggo
logger.lg.scriviLog(string.Format("pzCounterTC: effettuate {0} call", nCall), tipoLog.INFO);
// resetto!
memLayer.ML.resetRCnt(mHash("COUNT:pCall:getCounterTC"));
}
}
try
{
answ = DataLayer.obj.taMSE.getByIdxMacchina(idxMacchina)[0].PezziProd;
}
catch
{ }
return answ;
}
/// <summary>
/// Restituisce il contapezzi salvato per la macchina
/// </summary>
@@ -1266,6 +1296,7 @@ namespace MapoDb
public static int pzCounter(string idxMacchina)
{
int answ = -1;
string rCall = "";
if (memLayer.ML.CRB("IOB_RedEnab"))
{
@@ -1282,7 +1313,17 @@ namespace MapoDb
}
try
{
int.TryParse(memLayer.ML.getRSV(pzCountHash(idxMacchina)), out answ);
rCall = memLayer.ML.getRSV(pzCountHash(idxMacchina));
if (rCall != "" && rCall != null)
{
int.TryParse(rCall, out answ);
}
else
{
answ = pzCounterTC(idxMacchina);
// salvo in redis...
saveCounter(idxMacchina, answ.ToString());
}
}
catch
{ }