Update IO: salva e recupera counter x pz
This commit is contained in:
@@ -194,7 +194,7 @@
|
||||
</site>
|
||||
<site name="MP-MON" id="6">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\samuele\Documents\VisualStudioProjects\MoonPro_dotnet\MP-MON" />
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\samuele.steamw\Documents\Visual Studio 2017\Projects\MoonPro_dotnet\MP-MON" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:56580:localhost" />
|
||||
|
||||
Vendored
+3
-3
@@ -17,9 +17,9 @@ pipeline {
|
||||
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=731']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '5.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '5.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
withEnv(['NEXT_BUILD_NUMBER=732']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '5.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '5.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'MAPO'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,5 +140,55 @@ namespace MP_IO.Controllers
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera COUNTER x macchina:
|
||||
///
|
||||
/// GET: IOB/getCounter/5
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public string getCounter(string id)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = DataLayer.pzCounter(id).ToString();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in counter (get){0}{1}", Environment.NewLine, exc));
|
||||
answ = "NO";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// SALVA Counter x macchina:
|
||||
///
|
||||
/// GET: IOB/setCounter/5?counter=10
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="counter"></param>
|
||||
/// <returns></returns>
|
||||
public string setCounter(string id, string counter)
|
||||
{
|
||||
string answ = "";
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
if (memLayer.ML.CRI("_logLevel") > 6)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Salvataggio counter:{0}idxMacchina: {1}{0}conteggio: {2}", Environment.NewLine, id, counter), tipoLog.INFO);
|
||||
}
|
||||
try
|
||||
{
|
||||
answ = DataLayer.saveCounter(id, counter);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in counter (set){0}{1}", Environment.NewLine, exc));
|
||||
answ = "NO";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -792,6 +792,68 @@ namespace MapoDb
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Processa registrazione di un counter x una data macchina IOB
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="counter">Dati live nel formato chiave1|valore1#chiave2|valore2#chiave3|valore3</param>
|
||||
/// <returns></returns>
|
||||
public static string saveCounter(string idxMacchina, string counter)
|
||||
{
|
||||
if (counter == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(counter));
|
||||
}
|
||||
// registro conteggio impiego chiamate REDIS
|
||||
if (memLayer.ML.CRB("IOB_RedEnab"))
|
||||
{
|
||||
// conto la richiesta nel contatore REDIS
|
||||
long nCall = memLayer.ML.setRCntI(mHash("COUNT:setCounter"));
|
||||
//... se == nCall2Log scrivo su log e resetto
|
||||
long nCall2Log = memLayer.ML.cdvi("nCall2Log");
|
||||
if (nCall >= nCall2Log)
|
||||
{
|
||||
// loggo
|
||||
logger.lg.scriviLog(string.Format("saveCounter: effettuate {0} call", nCall), tipoLog.INFO);
|
||||
// resetto!
|
||||
memLayer.ML.resetRCnt(mHash("COUNT:setCounter"));
|
||||
}
|
||||
}
|
||||
string answ = "";
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
// inizio processing vero e proprio INPUT...
|
||||
if (idxMacchina != null && counter != null)
|
||||
{
|
||||
if (idxMacchina != "" && counter != "")
|
||||
{
|
||||
int newCounter = -1;
|
||||
int.TryParse(counter, out newCounter);
|
||||
// se il conteggio è >= 0 SALVO come nuovo conteggio...
|
||||
if (newCounter >= 0)
|
||||
{
|
||||
// salvo in Redis nell'area CURR_VAL TUTTI i valori live
|
||||
memLayer.ML.setRSV(pzCountHash(idxMacchina), counter);
|
||||
}
|
||||
// registro in risposta che è andato tutto bene...
|
||||
answ = "OK";
|
||||
}
|
||||
else
|
||||
{
|
||||
string errore = "Errore: parametri macchina/counter vuoti";
|
||||
logger.lg.scriviLog(errore, tipoLog.ERROR);
|
||||
answ = errore;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string errore = "Errore: mancano parametri macchina/counter";
|
||||
logger.lg.scriviLog(errore, tipoLog.ERROR);
|
||||
answ = errore;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#region definizioni hash x REDIS
|
||||
|
||||
/// <summary>
|
||||
@@ -822,6 +884,15 @@ namespace MapoDb
|
||||
return mHash(string.Format("StMac:{0}", idxMacchina));
|
||||
}
|
||||
/// <summary>
|
||||
/// Hash dati COUNTER x la macchina specificata
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public static string pzCountHash(string idxMacchina)
|
||||
{
|
||||
return mHash(string.Format("PzCount:{0}", idxMacchina));
|
||||
}
|
||||
/// <summary>
|
||||
/// Hash dati LIVE x la macchina specificata
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
@@ -1055,6 +1126,38 @@ namespace MapoDb
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il contapezzi salvato per la macchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public static int pzCounter(string idxMacchina)
|
||||
{
|
||||
int answ = -1;
|
||||
if (memLayer.ML.CRB("IOB_RedEnab"))
|
||||
{
|
||||
|
||||
// conto la richiesta nel contatore REDIS
|
||||
long nCall = memLayer.ML.setRCntI(mHash("COUNT:getCounter"));
|
||||
//... se == nCall2Log scrivo su log e resetto
|
||||
long nCall2Log = memLayer.ML.cdvi("nCall2Log");
|
||||
if (nCall >= nCall2Log)
|
||||
{
|
||||
// loggo
|
||||
logger.lg.scriviLog(string.Format("isMulti: effettuate {0} call", nCall), tipoLog.INFO);
|
||||
// resetto!
|
||||
memLayer.ML.resetRCnt(mHash("COUNT:getCounter"));
|
||||
}
|
||||
try
|
||||
{
|
||||
int.TryParse(memLayer.ML.getRSV(pzCountHash(idxMacchina)), out answ);
|
||||
//answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "Multi") == "1");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce il valore booleano se la macchina sia di tipo MULTI (con più state machine x INGRESSI)
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user