diff --git a/MP-SITE/BaseExportPage.cs b/MP-SITE/BaseExportPage.cs
index ca6d0432..234b49df 100644
--- a/MP-SITE/BaseExportPage.cs
+++ b/MP-SITE/BaseExportPage.cs
@@ -17,7 +17,7 @@ namespace MP_SITE
{
get
{
- string idxMacchina = "1";
+ string idxMacchina = "0";
try
{
idxMacchina = memLayer.ML.StringSessionObj("IdxMacchina");
@@ -32,6 +32,49 @@ namespace MP_SITE
memLayer.ML.setSessionVal("IdxMacchina", value);
}
}
+ ///
+ /// inizio periodo da mostrare
+ ///
+ public DateTime dtFrom
+ {
+ get
+ {
+ DateTime dtRif = DateTime.Now.AddDays(-30);
+ try
+ {
+ string rawDate = memLayer.ML.StringSessionObj("_inizio)");
+ if (!string.IsNullOrEmpty(rawDate))
+ {
+ DateTime.TryParse(rawDate, out dtRif);
+ }
+ }
+ catch
+ { }
+ return dtRif;
+ }
+ }
+
+ ///
+ /// fine periodo da mostrare
+ ///
+ public DateTime dtTo
+ {
+ get
+ {
+ DateTime dtRif = DateTime.Now;
+ try
+ {
+ string rawDate = memLayer.ML.StringSessionObj("_fine)");
+ if (!string.IsNullOrEmpty(rawDate))
+ {
+ DateTime.TryParse(rawDate, out dtRif);
+ }
+ }
+ catch
+ { }
+ return dtRif;
+ }
+ }
///
/// restituisce stringa formattata in HH:mm
@@ -43,10 +86,6 @@ namespace MP_SITE
string answ = "";
if (durataMinuti != null)
{
- //string durataFormattata = "";
- //int ore = (int)Math.Floor(((double)durataMinuti) / 60);
- //durataFormattata = string.Format("{0}h:{1:#.0}min", ore, (double)durataMinuti - 60 * ore);
- //return durataFormattata;
answ = durataMinuti.ToString();
}
return answ;
@@ -76,6 +115,17 @@ namespace MP_SITE
}
return _resoconti.oprDaMatr(matr);
}
+ ///
+ /// Recupera commessa al momento indicato
+ ///
+ ///
+ ///
+ public string commessaCorr(object _dtRif)
+ {
+ DateTime dtRif = DateTime.Now;
+ DateTime.TryParse($"{_dtRif}", out dtRif);
+ return _resoconti.commessaAttiva(idxMacchina, dtFrom, dtTo, dtRif);
+ }
public string statoDaIdx(object idx)
{
diff --git a/MP-SITE/excelAllMacchineExportStati.aspx b/MP-SITE/excelAllMacchineExportStati.aspx
index e4823f23..498e388a 100644
--- a/MP-SITE/excelAllMacchineExportStati.aspx
+++ b/MP-SITE/excelAllMacchineExportStati.aspx
@@ -28,6 +28,11 @@
+
+
+
+
+
-// Codice generato da uno strumento.
+//
+// This code was generated by a tool.
//
-// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
-// il codice viene rigenerato.
-//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
//------------------------------------------------------------------------------
namespace MP_SITE
@@ -15,20 +15,20 @@ namespace MP_SITE
{
///
- /// Controllo gvStati.
+ /// gvStati control.
///
///
- /// Campo generato automaticamente.
- /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.GridView gvStati;
///
- /// Controllo ods_DiarioDiBordo.
+ /// ods_DiarioDiBordo control.
///
///
- /// Campo generato automaticamente.
- /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.ObjectDataSource ods_DiarioDiBordo;
}
diff --git a/MP-SITE/excelExportStati.aspx b/MP-SITE/excelExportStati.aspx
index f39c6d25..40d11591 100644
--- a/MP-SITE/excelExportStati.aspx
+++ b/MP-SITE/excelExportStati.aspx
@@ -27,6 +27,11 @@
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+ SelectMethod="GetDataFiltered" TypeName="MapoDb.DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter">
+
+
+
+
+
+
-Excel Stati - solo macchina corrente
--
- Excel Stati - tutte le macchine
+Excel Stati - solo macchina corrente - Excel Stati - tutte le macchine
diff --git a/MP-Site/WebUserControls/mod_logStati.ascx.cs b/MP-Site/WebUserControls/mod_logStati.ascx.cs
index 7828cb7e..3f0df27c 100644
--- a/MP-Site/WebUserControls/mod_logStati.ascx.cs
+++ b/MP-Site/WebUserControls/mod_logStati.ascx.cs
@@ -3,25 +3,112 @@ using System;
namespace MP_SITE.WebUserControls
{
- public partial class mod_logStati : baseProdControl
- {
- public override void doUpdate()
+ public partial class mod_logStati : baseProdControl
{
- if (memLayer.ML.CRI("_logLevel") > 5)
- {
- logger.lg.scriviLog("inizio caricamento dati LogStati", tipoLog.INFO);
- }
- grView.PageSize = _numRighe;
- ods.DataBind();
- if (memLayer.ML.CRI("_logLevel") > 5)
- {
- logger.lg.scriviLog("fine caricamento dati LogStati", tipoLog.INFO);
- }
- }
- public void reportUpdt(object sender, EventArgs e)
- {
- reportUpdate();
- }
+ #region Public Properties
- }
+ ///
+ /// inizio periodo da mostrare
+ ///
+ public DateTime dtFrom
+ {
+ get
+ {
+ DateTime dtRif = DateTime.Now.AddDays(-30);
+ try
+ {
+ string rawDate = memLayer.ML.StringSessionObj("_inizio)");
+ if (!string.IsNullOrEmpty(rawDate))
+ {
+ DateTime.TryParse(rawDate, out dtRif);
+ }
+ }
+ catch
+ { }
+ return dtRif;
+ }
+ }
+
+ ///
+ /// fine periodo da mostrare
+ ///
+ public DateTime dtTo
+ {
+ get
+ {
+ DateTime dtRif = DateTime.Now;
+ try
+ {
+ string rawDate = memLayer.ML.StringSessionObj("_fine)");
+ if (!string.IsNullOrEmpty(rawDate))
+ {
+ DateTime.TryParse(rawDate, out dtRif);
+ }
+ }
+ catch
+ { }
+ return dtRif;
+ }
+ }
+
+ ///
+ /// idx della macchina da mostrare
+ ///
+ public string idxMacchina
+ {
+ get
+ {
+ string idxMacchina = "1";
+ try
+ {
+ idxMacchina = memLayer.ML.StringSessionObj("IdxMacchina");
+ }
+ catch
+ {
+ }
+ return idxMacchina;
+ }
+ set
+ {
+ memLayer.ML.setSessionVal("IdxMacchina", value);
+ }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+
+ ///
+ /// Recupera commessa al momento indicato
+ ///
+ ///
+ ///
+ public string commessaCorr(object _dtRif)
+ {
+ DateTime dtRif = DateTime.Now;
+ DateTime.TryParse($"{_dtRif}", out dtRif);
+ return _resoconti.commessaAttiva(idxMacchina, dtFrom, dtTo, dtRif);
+ }
+
+ public override void doUpdate()
+ {
+ if (memLayer.ML.CRI("_logLevel") > 5)
+ {
+ logger.lg.scriviLog("inizio caricamento dati LogStati", tipoLog.INFO);
+ }
+ grView.PageSize = _numRighe;
+ ods.DataBind();
+ if (memLayer.ML.CRI("_logLevel") > 5)
+ {
+ logger.lg.scriviLog("fine caricamento dati LogStati", tipoLog.INFO);
+ }
+ }
+
+ public void reportUpdt(object sender, EventArgs e)
+ {
+ reportUpdate();
+ }
+
+ #endregion Public Methods
+ }
}
\ No newline at end of file
diff --git a/MP-Site/WebUserControls/mod_logStati.ascx.designer.cs b/MP-Site/WebUserControls/mod_logStati.ascx.designer.cs
index 9e102045..818174b8 100644
--- a/MP-Site/WebUserControls/mod_logStati.ascx.designer.cs
+++ b/MP-Site/WebUserControls/mod_logStati.ascx.designer.cs
@@ -1,50 +1,52 @@
//------------------------------------------------------------------------------
-//
-// Codice generato da uno strumento.
+//
+// This code was generated by a tool.
//
-// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
-// il codice viene rigenerato.
-//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
//------------------------------------------------------------------------------
-namespace MP_SITE.WebUserControls {
-
-
- public partial class mod_logStati {
-
+namespace MP_SITE.WebUserControls
+{
+
+
+ public partial class mod_logStati
+ {
+
///
- /// Controllo grView.
+ /// grView control.
///
///
- /// Campo generato automaticamente.
- /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.GridView grView;
-
+
///
- /// Controllo ods.
+ /// ods control.
///
///
- /// Campo generato automaticamente.
- /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
-
+
///
- /// Controllo HyperLink1.
+ /// HyperLink1 control.
///
///
- /// Campo generato automaticamente.
- /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.HyperLink HyperLink1;
-
+
///
- /// Controllo HyperLink3.
+ /// HyperLink3 control.
///
///
- /// Campo generato automaticamente.
- /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.HyperLink HyperLink3;
}
diff --git a/MapoDb/resoconti.cs b/MapoDb/resoconti.cs
index 66d8032c..4959708d 100644
--- a/MapoDb/resoconti.cs
+++ b/MapoDb/resoconti.cs
@@ -1,3 +1,4 @@
+using AjaxControlToolkit;
using MapoDb;
using Newtonsoft.Json;
using SteamWare;
@@ -584,6 +585,7 @@ public class resoconti
protected MapoDb.DS_applicazioneTableAdapters.AnagraficaStatiTableAdapter taStati;
protected MapoDb.DS_applicazioneTableAdapters.StatoMacchineTableAdapter taStatoMacchine;
protected MapoDb.DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter taTempiCiclo;
+ protected MapoDb.DS_ProdTempiTableAdapters.ODLTableAdapter taODL;
#endregion Protected Fields
@@ -800,6 +802,81 @@ public class resoconti
return _StatoMacchine;
}
}
+ ///
+ /// Recupera tab ODL per periodo e impianto indicati
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected DS_ProdTempi.ODLDataTable OdlPeriodo(string idxMacchina, DateTime inizio, DateTime fine)
+ {
+ // cache redis di 5 minuti...
+ int cacheTtl = 300;
+ DS_ProdTempi.ODLDataTable odlReq = null;
+ string redKey = memLayer.ML.redHash($"OdlPeriodo:{idxMacchina}:{inizio:yyyy-MM-dd}:{inizio:HH:mm}");
+ string rawVal = memLayer.ML.getRSV(redKey);
+ if (string.IsNullOrEmpty(rawVal))
+ {
+ odlReq = taODL.getByMacchinaPeriodoNoNull(idxMacchina, inizio, fine);
+ rawVal = JsonConvert.SerializeObject(odlReq);
+ memLayer.ML.setRSV(redKey, rawVal, cacheTtl);
+ }
+ else
+ {
+ try
+ {
+ odlReq = JsonConvert.DeserializeObject(rawVal);
+ }
+ catch
+ { }
+ }
+ return odlReq;
+ }
+ ///
+ /// Recupera record odl al momento indicato
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected DS_ProdTempi.ODLRow currOdl(string idxMacchina, DateTime inizio, DateTime fine, DateTime dataRif)
+ {
+ DS_ProdTempi.ODLRow answ = null;
+ var tabOdl = OdlPeriodo(idxMacchina, inizio, fine);
+ if (tabOdl != null)
+ {
+ answ = tabOdl
+ .Where(x => x.DataInizio <= dataRif && (x.DataFine >= dataRif || x.DataFine == null))
+ .FirstOrDefault();
+ }
+ return answ;
+ }
+ ///
+ /// Recupera commessa attiva al momento indicato
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string commessaAttiva(string idxMacchina, DateTime inizio, DateTime fine, DateTime dataRif)
+ {
+ string answ = "NA";
+ var tabOdl = OdlPeriodo(idxMacchina, inizio, fine);
+ if (tabOdl != null)
+ {
+ var currRow = tabOdl
+ .Where(x => x.DataInizio <= dataRif && (x.DataFine >= dataRif || x.DataFine == null))
+ .FirstOrDefault();
+ if (currRow != null)
+ {
+ answ = currRow.KeyRichiesta;
+ }
+ }
+ return answ;
+ }
#endregion Protected Properties
@@ -925,6 +1002,7 @@ public class resoconti
taAnagArt = new MapoDb.DS_applicazioneTableAdapters.AnagArticoliTableAdapter();
taAnagOpr = new MapoDb.DS_applicazioneTableAdapters.AnagraficaOperatoriTableAdapter();
taTempiCiclo = new MapoDb.DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter();
+ taODL = new MapoDb.DS_ProdTempiTableAdapters.ODLTableAdapter();
}
///
@@ -996,6 +1074,7 @@ public class resoconti
taAnagArt.Connection.ConnectionString = _connectionString;
taAnagOpr.Connection.ConnectionString = _connectionString;
taTempiCiclo.Connection.ConnectionString = _connectionString;
+ taODL.Connection.ConnectionString = _connectionString;
}
#endregion Private Methods