fix calcolo differenza oraria x MP-IO
This commit is contained in:
Binary file not shown.
+25
-4
@@ -206,7 +206,7 @@ namespace MapoDb
|
||||
{
|
||||
DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd = DataLayer.obj.taPzProd2conf.GetData(idxMacchina.ToString())[0];
|
||||
// chiamo stored stp_ConfermaProduzCompleta(idxMacchina,MatrApp,dataFrom,dataTo,pezziConf)
|
||||
taPzProd2conf.stp_ConfermaProduzCompleta(idxMacchina, MatrOpr, rigaProd.DataFrom, rigaProd.DataTo, numPzConfermati, numPzScarto, modoConfProd,DateTime.Now, true);
|
||||
taPzProd2conf.stp_ConfermaProduzCompleta(idxMacchina, MatrOpr, rigaProd.DataFrom, rigaProd.DataTo, numPzConfermati, numPzScarto, modoConfProd, DateTime.Now, true);
|
||||
// indico eseguito!
|
||||
answ = true;
|
||||
}
|
||||
@@ -408,15 +408,20 @@ namespace MapoDb
|
||||
/// <returns></returns>
|
||||
public static string processInput(string idxMacchina, string valore, string dtEve, string dtCurr, string contatore)
|
||||
{
|
||||
|
||||
|
||||
string answ = "";
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
DateTime dtEvento, dtCorrente;
|
||||
// controllo: se ho valori dt x evento e orario DIVERSI per acquisitore IOB calcolo dataOraEvento corretto
|
||||
if (dtEve != dtCurr)
|
||||
{
|
||||
Int64 delta = 0;
|
||||
try
|
||||
{
|
||||
if (dtEve.Length < dtCurr.Length)
|
||||
{
|
||||
dtEve = dtEve.PadRight(dtCurr.Length, '0');
|
||||
}
|
||||
delta = Convert.ToInt64(dtCurr) - Convert.ToInt64(dtEve);
|
||||
// se meno di 60'000 ms ...
|
||||
if (delta < 59999)
|
||||
@@ -427,9 +432,25 @@ namespace MapoDb
|
||||
{
|
||||
// in questo caso elimino i MS dalle stringhe e converto i datetime....
|
||||
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||
string formatShort = "yyyyMMddHHmmss";
|
||||
string format = "yyyyMMddHHmmssfff";
|
||||
DateTime dtEvento = DateTime.ParseExact(dtEve, format, provider);
|
||||
DateTime dtCorrente = DateTime.ParseExact(dtCurr, format, provider);
|
||||
// SE ho solo fino ai secondi uso formatShort...
|
||||
if (dtEve.Length > 14)
|
||||
{
|
||||
dtEvento = DateTime.ParseExact(dtEve, format, provider);
|
||||
}
|
||||
else
|
||||
{
|
||||
dtEvento = DateTime.ParseExact(dtEve, formatShort, provider);
|
||||
}
|
||||
if (dtCurr.Length > 14)
|
||||
{
|
||||
dtCorrente = DateTime.ParseExact(dtCurr, format, provider);
|
||||
}
|
||||
else
|
||||
{
|
||||
dtCorrente = DateTime.ParseExact(dtCurr, formatShort, provider);
|
||||
}
|
||||
Int64 tiks = dtCorrente.Ticks - dtEvento.Ticks;
|
||||
dataOraEvento = dataOraEvento.AddTicks(-tiks);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user