test prima parte preprocessing: OK
This commit is contained in:
+62
-11
@@ -477,12 +477,13 @@ namespace MapoDb
|
||||
if (DataLayer.isMulti(idxMacchina))
|
||||
{
|
||||
// inizio preprocessing
|
||||
|
||||
string newVal = "";
|
||||
// processo OGNI macchina a stati dell'impianto... (IdxMacchina e IdxMacchina#qualcosa...)
|
||||
//foreach(){ !!!FARE!!!
|
||||
newVal = preProcInput(idxMacchina, valore);
|
||||
// ora processo e salvo il valore del microstato... INTERNAMENTE gestisce i casi DB/REDIS secondo necessità
|
||||
connDb.checkMicroStato(idxMacchina, valore, dataOraEvento, contatore);
|
||||
|
||||
// ora processo i SUB-systems
|
||||
|
||||
connDb.checkMicroStato(idxMacchina, newVal, dataOraEvento, contatore);
|
||||
//}!!!FARE!!!
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -518,12 +519,13 @@ namespace MapoDb
|
||||
if (MapoDb.obj.isMulti(idxMacchina))
|
||||
{
|
||||
// inizio preprocessing
|
||||
|
||||
string newVal = "";
|
||||
// processo OGNI macchina a stati dell'impianto... (IdxMacchina e IdxMacchina#qualcosa...)
|
||||
//foreach(){ !!!FARE!!!
|
||||
newVal = preProcInput(idxMacchina, valore);
|
||||
// ora processo e salvo il valore del microstato...
|
||||
MapoDb.obj.checkMicroStato(idxMacchina, valore, dataOraEvento, contatore);
|
||||
|
||||
// ora processo i SUB-systems
|
||||
|
||||
MapoDb.obj.checkMicroStato(idxMacchina, newVal, dataOraEvento, contatore);
|
||||
//}!!!FARE!!!
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -558,6 +560,55 @@ namespace MapoDb
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Calcola l'effettivo valore da passare alla macchina a stati INGRESSI data conf Macchine2FamigliaIngressi
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="valore"></param>
|
||||
/// <returns></returns>
|
||||
private static string preProcInput(string idxMacchina, string valore)
|
||||
{
|
||||
string newVal = "";
|
||||
try
|
||||
{
|
||||
// variabili
|
||||
int valINT = 0;
|
||||
int BitFilt = 0;
|
||||
int BSR = 0;
|
||||
bool ExplodeBit = false;
|
||||
int newValInt = 0;
|
||||
// recupero parametri...
|
||||
int.TryParse(DataLayer.mDatiMacchinaVal(idxMacchina, "BitFilt"), out BitFilt);
|
||||
int.TryParse(DataLayer.mDatiMacchinaVal(idxMacchina, "BSR"), out BSR);
|
||||
Boolean.TryParse(DataLayer.mDatiMacchinaVal(idxMacchina, "ExplodeBit"), out ExplodeBit);
|
||||
// recupero valore
|
||||
valINT = int.Parse(valore, System.Globalization.NumberStyles.HexNumber);
|
||||
// filtro
|
||||
newValInt = utility.bMaskInt(valINT, BitFilt);
|
||||
// effettuo eventuale BitShiftRight
|
||||
if (BSR > 0)
|
||||
{
|
||||
newValInt = newValInt << BSR;
|
||||
}
|
||||
// effettuo eventuale esplosione in BIT esclusivi
|
||||
if (ExplodeBit)
|
||||
{
|
||||
// esplodo a tanti BIT quanto è il MAX dei valori gestiti...
|
||||
|
||||
//... e poi a int...
|
||||
|
||||
}
|
||||
|
||||
// riconverto a STRING HEX!!!
|
||||
newVal = newValInt.ToString("X");
|
||||
}
|
||||
catch
|
||||
{
|
||||
newVal = valore;
|
||||
}
|
||||
|
||||
return newVal;
|
||||
}
|
||||
|
||||
#region definizioni hash x REDIS
|
||||
|
||||
@@ -788,7 +839,7 @@ namespace MapoDb
|
||||
}
|
||||
try
|
||||
{
|
||||
answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "Multi"));
|
||||
answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "Multi") == "1");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
+10
-2
@@ -178,8 +178,16 @@ public class utility
|
||||
}
|
||||
return durataFormattata;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Effettua la masking di un valore (INT) rispetto ad una BitMask (INT)
|
||||
/// </summary>
|
||||
/// <param name="valore">Valore da filtrare</param>
|
||||
/// <param name="bitMask">BitMask (espresso in valore INT: es 1001 --> 9)</param>
|
||||
/// <returns></returns>
|
||||
public static int bMaskInt(int valore, int bitMask)
|
||||
{
|
||||
return valore & bitMask;
|
||||
}
|
||||
|
||||
|
||||
#region Inizializzazione
|
||||
|
||||
Reference in New Issue
Block a user