From 9ebaa3c731b6de50a17e00b0e41356efd229977b Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 4 May 2021 20:17:09 +0200 Subject: [PATCH] ancora traduzioni SITE --- MP-SITE/DettaglioMacchina.aspx | 121 +-- MP-SITE/DettaglioMacchina.aspx.designer.cs | 116 +-- MP-SITE/StatisticheImpiego.aspx | 59 +- MP-SITE/StatisticheImpiego.aspx.cs | 43 +- MP-SITE/StatisticheImpiego.aspx.designer.cs | 46 +- MP-Site/MP-Site.csproj | 4 +- .../WebUserControls/mod_periodoAnalisi.ascx | 25 +- .../mod_periodoAnalisi.ascx.designer.cs | 100 +-- .../WebUserControls/mod_statoMacchina.ascx.cs | 824 +++++++++--------- 9 files changed, 701 insertions(+), 637 deletions(-) diff --git a/MP-SITE/DettaglioMacchina.aspx b/MP-SITE/DettaglioMacchina.aspx index d7c087ac..10a6704d 100644 --- a/MP-SITE/DettaglioMacchina.aspx +++ b/MP-SITE/DettaglioMacchina.aspx @@ -1,76 +1,77 @@ <%@ Page Language="C#" MasterPageFile="~/WebMasterPages/MAPO_refresh30.master" AutoEventWireup="true" Inherits="MP_SITE.DettaglioMacchina" Title="Dettaglio Macchina" CodeBehind="DettaglioMacchina.aspx.cs" Async="true" %> <%@ Register Src="~/WebUserControls/mod_sequencerStati.ascx" TagName="mod_sequencerStati" - TagPrefix="uc5" %> + TagPrefix="uc5" %> <%@ Register Src="~/WebUserControls/mod_grafico.ascx" TagName="mod_grafico" TagPrefix="uc4" %> <%@ Register Src="~/WebUserControls/mod_immagineStato.ascx" TagName="mod_immagineStato" TagPrefix="uc3" %> <%@ Register Src="~/WebUserControls/mod_periodoAnalisi.ascx" TagName="mod_periodoAnalisi" TagPrefix="uc2" %> <%@ Register Src="~/WebUserControls/mod_listaStatiEventi.ascx" TagName="mod_listaStatiEventi" TagPrefix="uc1" %> <%@ Register Src="WebUserControls/mod_sequencerTempiCiclo.ascx" TagName="mod_sequencerTempiCiclo" TagPrefix="uc6" %> -
-
- -
-
- - - - - - -
-
-
-
-
-
-

Stato Macchina

-
-
-
- -
-
- -
-
- - - - +
+
+
-
-
-
-
-

Dati Produzione

-
-
- +
+ - + + - -
-
+ +
+
+
+
+
+
+

Stato Macchina

+
+
+
+ +
+
+ +
+
+ + + + + +
+
+
+
+
+
+
+

Dati Produzione

+
+
+ + + + + +
+
+
+
-
-
- + \ No newline at end of file diff --git a/MP-SITE/DettaglioMacchina.aspx.designer.cs b/MP-SITE/DettaglioMacchina.aspx.designer.cs index 8d6a3ffe..c6c9c02d 100644 --- a/MP-SITE/DettaglioMacchina.aspx.designer.cs +++ b/MP-SITE/DettaglioMacchina.aspx.designer.cs @@ -1,122 +1,124 @@ //------------------------------------------------------------------------------ -// -// 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 { - - - public partial class DettaglioMacchina { - +namespace MP_SITE +{ + + + public partial class DettaglioMacchina + { + /// - /// Controllo UpdatePanel2. + /// UpdatePanel2 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.UpdatePanel UpdatePanel2; - + /// - /// Controllo toStato. + /// toStato 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.Button toStato; - + /// - /// Controllo Mod_periodoAnalisi1. + /// Mod_periodoAnalisi1 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::MP_SITE.WebUserControls.mod_periodoAnalisi Mod_periodoAnalisi1; - + /// - /// Controllo up_grafici. + /// up_grafici 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.UpdatePanel up_grafici; - + /// - /// Controllo Mod_sequencerStati1. + /// Mod_sequencerStati1 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::MP_SITE.WebUserControls.mod_sequencerStati Mod_sequencerStati1; - + /// - /// Controllo mod_sequencerTempiCiclo1. + /// mod_sequencerTempiCiclo1 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::MP_SITE.WebUserControls.mod_sequencerTempiCiclo mod_sequencerTempiCiclo1; - + /// - /// Controllo Mod_immagineStato1. + /// Mod_immagineStato1 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::MP_SITE.WebUserControls.mod_immagineStato Mod_immagineStato1; - + /// - /// Controllo chkHideSpenta. + /// chkHideSpenta 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.CheckBox chkHideSpenta; - + /// - /// Controllo UpdatePanel3. + /// UpdatePanel3 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.UpdatePanel UpdatePanel3; - + /// - /// Controllo Mod_grafico2. + /// Mod_grafico2 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::MP_SITE.WebUserControls.mod_grafico Mod_grafico2; - + /// - /// Controllo UpdatePanel1. + /// UpdatePanel1 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.UpdatePanel UpdatePanel1; - + /// - /// Controllo Mod_listaStatiEventi1. + /// Mod_listaStatiEventi1 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::MP_SITE.WebUserControls.mod_listaStatiEventi Mod_listaStatiEventi1; } diff --git a/MP-SITE/StatisticheImpiego.aspx b/MP-SITE/StatisticheImpiego.aspx index 34df6647..2c209d2f 100644 --- a/MP-SITE/StatisticheImpiego.aspx +++ b/MP-SITE/StatisticheImpiego.aspx @@ -4,41 +4,48 @@ <%@ Register Src="~/WebUserControls/mod_periodoAnalisi.ascx" TagPrefix="uc1" TagName="mod_periodoAnalisi" %> -
+ +
-
-
-
-
+
+
+
+

<%: traduci("FiltroPeriodoImpianti") %>

-
- <%--
--%> - -
- - +
+
+
+ +
+ + +
+
-
-
-
+
+
+

<%: traduci("Statistiche") %>

-
- <%--
--%> -
- -
-
- - - - - +
+
+
+
+ +
+
+ + + + + +
+
diff --git a/MP-SITE/StatisticheImpiego.aspx.cs b/MP-SITE/StatisticheImpiego.aspx.cs index b05f6705..fdaf7079 100644 --- a/MP-SITE/StatisticheImpiego.aspx.cs +++ b/MP-SITE/StatisticheImpiego.aspx.cs @@ -7,10 +7,16 @@ namespace MP_SITE { public partial class StatisticheImpiego : BasePage { + #region Protected Fields + protected intervalloDate _intervalloAnalisi; protected resoconti _resoconti; protected int durataMin; + #endregion Protected Fields + + #region Protected Properties + /// /// elenco idx COMMA separated da controllo selezione multiplo /// @@ -56,6 +62,28 @@ namespace MP_SITE } } + #endregion Protected Properties + + #region Private Methods + + private void Mod_periodoAnalisi1_eh_doUpdate(object sender, EventArgs e) + { + ridisegna(); + } + + /// + /// aggiorna dati x ridisegno + /// + private void ridisegna() + { + intervalloAnalisi = (intervalloDate)memLayer.ML.objSessionObj("_intervallo"); + setTorta(); + } + + #endregion Private Methods + + #region Protected Methods + protected void chkHideSpenta_CheckedChanged(object sender, EventArgs e) { // in base a quello ridisegno la torta... @@ -93,6 +121,7 @@ namespace MP_SITE mod_periodoAnalisi.eh_doUpdate += new EventHandler(Mod_periodoAnalisi1_eh_doUpdate); if (!Page.IsPostBack) { + chkHideSpenta.DataBind(); ridisegna(); } } @@ -110,18 +139,6 @@ namespace MP_SITE } } - private void Mod_periodoAnalisi1_eh_doUpdate(object sender, EventArgs e) - { - ridisegna(); - } - - /// - /// aggiorna dati x ridisegno - /// - private void ridisegna() - { - intervalloAnalisi = (intervalloDate)memLayer.ML.objSessionObj("_intervallo"); - setTorta(); - } + #endregion Protected Methods } } \ No newline at end of file diff --git a/MP-SITE/StatisticheImpiego.aspx.designer.cs b/MP-SITE/StatisticheImpiego.aspx.designer.cs index 35bfc113..64240b11 100644 --- a/MP-SITE/StatisticheImpiego.aspx.designer.cs +++ b/MP-SITE/StatisticheImpiego.aspx.designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ -// -// 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,56 +15,56 @@ namespace MP_SITE { /// - /// Controllo mod_periodoAnalisi. + /// mod_periodoAnalisi 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::MP_SITE.WebUserControls.mod_periodoAnalisi mod_periodoAnalisi; /// - /// Controllo listMacchine. + /// listMacchine 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.ListBox listMacchine; /// - /// Controllo odsMacchine. + /// odsMacchine 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 odsMacchine; /// - /// Controllo chkHideSpenta. + /// chkHideSpenta 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.CheckBox chkHideSpenta; /// - /// Controllo UpdatePanel3. + /// UpdatePanel3 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.UpdatePanel UpdatePanel3; /// - /// Controllo Mod_grafico2. + /// Mod_grafico2 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::MP_SITE.WebUserControls.mod_grafico Mod_grafico2; } diff --git a/MP-Site/MP-Site.csproj b/MP-Site/MP-Site.csproj index f35fc47d..516b2baa 100644 --- a/MP-Site/MP-Site.csproj +++ b/MP-Site/MP-Site.csproj @@ -300,7 +300,9 @@ - + + Always + diff --git a/MP-Site/WebUserControls/mod_periodoAnalisi.ascx b/MP-Site/WebUserControls/mod_periodoAnalisi.ascx index a3f2a1df..38b2587c 100644 --- a/MP-Site/WebUserControls/mod_periodoAnalisi.ascx +++ b/MP-Site/WebUserControls/mod_periodoAnalisi.ascx @@ -1,8 +1,9 @@ <%@ Control Language="C#" AutoEventWireup="true" Inherits="MP_SITE.WebUserControls.mod_periodoAnalisi" CodeBehind="mod_periodoAnalisi.ascx.cs" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> -
-
+ +
+
23 - + FirstDayOfWeek="Monday" Format="dd/MM/yyyy">
-
+
23 - + FirstDayOfWeek="Monday" Format="dd/MM/yyyy">
-
+
selezione oggi @@ -80,15 +79,11 @@ questo mese ultimi 30gg -     +   - -
-
-    +  
-
-
+
\ No newline at end of file diff --git a/MP-Site/WebUserControls/mod_periodoAnalisi.ascx.designer.cs b/MP-Site/WebUserControls/mod_periodoAnalisi.ascx.designer.cs index cd882a78..2b2b3d90 100644 --- a/MP-Site/WebUserControls/mod_periodoAnalisi.ascx.designer.cs +++ b/MP-Site/WebUserControls/mod_periodoAnalisi.ascx.designer.cs @@ -1,104 +1,106 @@ //------------------------------------------------------------------------------ -// -// 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_periodoAnalisi { - +namespace MP_SITE.WebUserControls +{ + + + public partial class mod_periodoAnalisi + { + /// - /// Controllo txtInizio. + /// txtInizio 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.TextBox txtInizio; - + /// - /// Controllo ddlOraInizio. + /// ddlOraInizio 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.DropDownList ddlOraInizio; - + /// - /// Controllo CalendarExtender1. + /// CalendarExtender1 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::AjaxControlToolkit.CalendarExtender CalendarExtender1; - + /// - /// Controllo txtFine. + /// txtFine 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.TextBox txtFine; - + /// - /// Controllo ddlOraFine. + /// ddlOraFine 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.DropDownList ddlOraFine; - + /// - /// Controllo CalendarExtender2. + /// CalendarExtender2 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::AjaxControlToolkit.CalendarExtender CalendarExtender2; - + /// - /// Controllo ddlPeriodo. + /// ddlPeriodo 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.DropDownList ddlPeriodo; - + /// - /// Controllo btnUpdate. + /// btnUpdate 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.Button btnUpdate; - + /// - /// Controllo lblDurataMin. + /// lblDurataMin 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.Label lblDurataMin; - + /// - /// Controllo txtDurataMin. + /// txtDurataMin 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.TextBox txtDurataMin; } diff --git a/MP-Site/WebUserControls/mod_statoMacchina.ascx.cs b/MP-Site/WebUserControls/mod_statoMacchina.ascx.cs index 97a2440e..a5e0c375 100644 --- a/MP-Site/WebUserControls/mod_statoMacchina.ascx.cs +++ b/MP-Site/WebUserControls/mod_statoMacchina.ascx.cs @@ -2,426 +2,464 @@ using MapoDb; using Newtonsoft.Json; using SteamWare; using System; +using System.IO; namespace MP_SITE.WebUserControls { - public partial class mod_statoMacchina : System.Web.UI.UserControl - { - - /// - /// Oggetto datalayer specifico - /// - DataLayer DataLayerObj = new DataLayer(); - - #region area protected / private - - /// - /// seriale associato alla macchina da controllare - /// - protected string _IdxMacchina + public partial class mod_statoMacchina : System.Web.UI.UserControl { - get - { - return hfIdxMacchina.Value; - } - set - { - hfIdxMacchina.Value = value.Trim(); - } - } - /// - /// posizione macchina nella tabella - /// - protected string _locazione; - protected bool _linkActive = true; + #region Private Fields - protected DS_ProdTempi.MappaStatoExplDataTable tabMSE; - protected DS_applicazione.AnagraficaStatiDataTable tabAnagStati; - /// - /// caricamento pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) - { - //updateMe(); - } - /// - /// aggiorna controllo - /// - public void updateMe() - { - //SE E SOLO SE ho una macchina e/o locazione... - if (!string.IsNullOrEmpty(IdxMacchina) && !IdxMacchina.Contains("#") && (locazione != "00")) - { - // effettua update visualizzazione - try - { - retrieveData(); - updateLayout(); - updateText(); - updateImg(); - updateHL(); - // controllo se link attivo... - if (!_linkActive) - { - valMacchina.Enabled = false; - } - //logger.lg.scriviLog(string.Format("Retrieve: {0}", DateTime.Now.Subtract(tick).Milliseconds), tipoLog.INFO); - divSegnaposto.Visible = false; - } - catch (Exception exc) - { - logger.lg.scriviLog($"Eccezione in fase popolamento statoMacchina per IdxMacchina {IdxMacchina} - locazione {locazione}{Environment.NewLine}{exc}", tipoLog.EXCEPTION); - } - } - else - { - pnlMacchina.Visible = false; - } - } - /// - /// recupera i dati - /// - private void retrieveData() - { - // cerco se ho i dati in REDIS x non richiederli... - string hashKeyMSE = memLayer.ML.redHash("Tab:MSE:" + IdxMacchina); - string hashKeyAS = memLayer.ML.redHash("Tab:AnagStati"); - string serVal = ""; - if (memLayer.ML.redKeyPresent(hashKeyMSE)) - //if (memLayer.ML.redHashPresent(hashKeyMSE)) - { - serVal = memLayer.ML.getRSV(hashKeyMSE); + /// + /// Oggetto datalayer specifico + /// + private DataLayer DataLayerObj = new DataLayer(); - tabMSE = JsonConvert.DeserializeObject(serVal); - //tabMSE = (DS_ProdTempi.MappaStatoExplDataTable)memLayer.ML.deserializeVal(serVal); + #endregion Private Fields - serVal = memLayer.ML.getRSV(hashKeyAS); - tabAnagStati = JsonConvert.DeserializeObject(serVal); - //tabAnagStati = (DS_applicazione.AnagraficaStatiDataTable)memLayer.ML.deserializeVal(serVal); - } - else - { - // altrimenti prendo da DB... - try - { - // popolazione tabelle - tabMSE = DataLayerObj.taMSE.getByIdxMacchina(IdxMacchina); - tabAnagStati = DataLayerObj.taAnagStati.GetData(); - } - catch - { } - // salvo su DB! dati principali x 30 secondi... - serVal = memLayer.ML.serializeVal(tabMSE); - memLayer.ML.setRSV(hashKeyMSE, serVal, 30); - // anche il resto... - serVal = memLayer.ML.serializeVal(tabAnagStati); - memLayer.ML.setRSV(hashKeyAS, serVal); - } - } - /// - /// sistema il testo - /// - private void updateText() - { - if (!string.IsNullOrEmpty(_IdxMacchina) && _IdxMacchina != "nd") - { - // labels - lblCodArticolo.Text = "Art."; - lblStato.Text = "Stato"; - lblProd.Text = "T.Ciclo"; // era OEE - lblDurata.Text = "Durata"; - // 2018.02.05 cambio x fix nuovi impianti - // valMacchina.Text = tabMacchine.FindByIdxMacchina(IdxMacchina).Nome; - // valCodArticolo.Text = tabStatoMacchine.FindByIdxMacchina(IdxMacchina).CodArticolo; + #region Protected Fields - // leggo valori da MSE... - valMacchina.Text = tabMSE[0].Nome; - valCodArticolo.Text = tabMSE[0].CodArticolo; - // carico ultimo stato che sia durato almeno 6 sec (0.1 min) - int idxStato = 0; - int oreTot = 0; - float minuti = 0; - try - { - DS_ProdTempi.stp_repDonati_getLastStatoDurataMacchinaRow rigaStato = DataLayerObj.taDatiStatoMacch.GetData(IdxMacchina, 0.1)[0]; - idxStato = rigaStato.idxStato; - oreTot = Convert.ToInt32(Math.Floor(rigaStato.Minuti / 60)); - minuti = (float)rigaStato.Minuti - 60 * oreTot; - } - catch - { - // 2018.02.05 cambio x fix nuovi impianti - //idxStato = tabStatoMacchine.FindByIdxMacchina(IdxMacchina).IdxStato; - //DateTime inizioStato = tabStatoMacchine.FindByIdxMacchina(IdxMacchina).InizioStato; - //DateTime ora = DateTime.Now; - //TimeSpan durata = ora.Subtract(inizioStato); - //oreTot = durata.Days * 24 + durata.Hours; - //minuti = durata.Minutes; - idxStato = tabMSE[0].idxStato; - oreTot = (int)tabMSE[0].durata / 60; - minuti = (int)tabMSE[0].durata - 60 * oreTot; - } - // 2018.02.05 cambio x fix nuovi impianti - //valStato.Text = tabAnagStati.FindByIdxStato(idxStato).Descrizione; - valStato.Text = tabMSE[0].DescrizioneStato; - valDurata.Text = string.Format("{0}h {1}min", oreTot, minuti); - // solo se in stato NON di run... - if (idxStato != 13) - { - lblCausale.Text = "Causale fermo"; - string cauFermo = "nd"; - try - { - cauFermo = tabAnagStati.FindByIdxStato(tabMSE[0].idxStato).Descrizione; - //cauFermo = tabAnagStati.FindByIdxStato(Convert.ToInt32(tabStatoMacchine.FindByIdxMacchina(IdxMacchina).IdxStato)).Descrizione; - } - catch - { - // 2018.02.05 cambio x fix nuovi impianti - //cauFermo = string.Format("IN: {0}", tabStatoMacchine.FindByIdxMacchina(IdxMacchina).Value); - cauFermo = string.Format("IN: {0}", tabMSE[0].idxStato); - } - valCausale.Text = cauFermo; - } - else - { - lblCausale.Text = ""; - valCausale.Text = ""; - } + protected bool _linkActive = true; - // ATTENZIONE! dati generati casualmente, da cambiare in produzione!!! - bool demoRandom = false; - if (demoRandom) - { - // indico a caso % pz prodotti... - Random RandomClass = new Random(DateTime.Now.Millisecond); - if (idxStato == 13) - { - valProd.Text = string.Format("{0:P}", RandomClass.NextDouble() / 4 + 0.75); - } - else if (oreTot > 8) - { - valProd.Text = string.Format("{0:P}", 0); - } - else - { - valProd.Text = string.Format("{0:P}", RandomClass.NextDouble() / 2 + 0.25); - } - } - else // mostra lo stesso valore per tutti e due - { - // prova...se non ha dati relativa mostra n/a - not available + /// + /// posizione macchina nella tabella + /// + protected string _locazione; - DateTime Ora = DateTime.Now; + protected DS_applicazione.AnagraficaStatiDataTable tabAnagStati; - valProd.Text = "1H: "; - string emptyVal = "n/a
"; - int numPezzi = 0; - // prova l'ultima ora - try - { - // conto num pezzi e divido 1h/pezzi - numPezzi = DataLayerObj.taTempiCicloRilevati.getByMacchinaPeriodo(IdxMacchina, Ora.AddHours(-1), Ora).Rows.Count; - if (numPezzi > 0) + protected DS_ProdTempi.MappaStatoExplDataTable tabMSE; + + #endregion Protected Fields + + #region Protected Properties + + /// + /// seriale associato alla macchina da controllare + /// + protected string _IdxMacchina + { + get { - valProd.Text += String.Format("{0:#.00}m
", Math.Round((double)60 / numPezzi, 3)); + return hfIdxMacchina.Value; + } + set + { + hfIdxMacchina.Value = value.Trim(); + } + } + + #endregion Protected Properties + + #region Public Properties + + /// + /// Idx della macchina controllata + /// + public string IdxMacchina + { + get + { + return _IdxMacchina; + } + set + { + if (resoconti.mngr == null) + { + resoconti.mngr = new resoconti(); + } + _IdxMacchina = value; + _locazione = resoconti.mngr.locazioneDaIdx(_IdxMacchina); + updateMe(); + } + } + + /// + /// definisce se sia attivo il link della pagina + /// + public bool linkActive + { + get + { + return _linkActive; + } + set + { + _linkActive = value; + } + } + + /// + /// stringa locazione macchina in tabella + /// + public string locazione + { + get + { + return _locazione; + } + set + { + if (resoconti.mngr == null) + { + resoconti.mngr = new resoconti(); + } + _locazione = value; + try + { + _IdxMacchina = resoconti.mngr.idxDaLocazione(_locazione); + updateMe(); + } + catch + { + _IdxMacchina = "nd"; + } + } + } + + #endregion Public Properties + + #region Private Methods + + /// + /// recupera i dati + /// + private void retrieveData() + { + // cerco se ho i dati in REDIS x non richiederli... + string hashKeyMSE = memLayer.ML.redHash("Tab:MSE:" + IdxMacchina); + string hashKeyAS = memLayer.ML.redHash("Tab:AnagStati"); + string serVal = ""; + if (memLayer.ML.redKeyPresent(hashKeyMSE)) + //if (memLayer.ML.redHashPresent(hashKeyMSE)) + { + serVal = memLayer.ML.getRSV(hashKeyMSE); + + tabMSE = JsonConvert.DeserializeObject(serVal); + //tabMSE = (DS_ProdTempi.MappaStatoExplDataTable)memLayer.ML.deserializeVal(serVal); + + serVal = memLayer.ML.getRSV(hashKeyAS); + tabAnagStati = JsonConvert.DeserializeObject(serVal); + //tabAnagStati = (DS_applicazione.AnagraficaStatiDataTable)memLayer.ML.deserializeVal(serVal); } else { - valProd.Text += emptyVal; + // altrimenti prendo da DB... + try + { + // popolazione tabelle + tabMSE = DataLayerObj.taMSE.getByIdxMacchina(IdxMacchina); + tabAnagStati = DataLayerObj.taAnagStati.GetData(); + } + catch + { } + // salvo su DB! dati principali x 30 secondi... + serVal = memLayer.ML.serializeVal(tabMSE); + memLayer.ML.setRSV(hashKeyMSE, serVal, 30); + // anche il resto... + serVal = memLayer.ML.serializeVal(tabAnagStati); + memLayer.ML.setRSV(hashKeyAS, serVal); } - } + } - catch - { - valProd.Text += emptyVal; - } - - // prova le ultime 8 ore - - valProd.Text += "8H: "; - numPezzi = 0; - try - { - // conto num pezzi e divido 1h/pezzi - numPezzi = DataLayerObj.taTempiCicloRilevati.getByMacchinaPeriodo(IdxMacchina, Ora.AddHours(-8), Ora).Rows.Count; - if (numPezzi > 0) + /// + /// sistema hyperLink + /// + private void updateHL() + { + bool answ = false; + int minuti = memLayer.ML.CRI("keepAliveMin"); + // controllo se il keep alive è oltre il termine... + DateTime lastKA = DateTime.Now.AddMinutes(-minuti); + if (_IdxMacchina != "nd") { - valProd.Text += String.Format("{0:#.00}m ", Math.Round((double)480 / numPezzi, 3)); + string nomeVar = string.Format("KeepAlive:{0}", _IdxMacchina); + string redKey = memLayer.ML.redHash(nomeVar); + var _lastKA = memLayer.ML.getRSV(redKey); + if (_lastKA == null) + { + answ = true; + //cerco su DB... + try + { + var tabDati = DataLayerObj.taKeepAlive.getByIdxMacchina(_IdxMacchina); + if (tabDati.Rows.Count > 0) + { + lastKA = tabDati[0].DataOraServer; + answ = (lastKA.AddMinutes(minuti) < DateTime.Now); + } + } + catch (Exception exc) + { + logger.lg.scriviLog($"Eccezione in updateHL per IdxMacchina {IdxMacchina} - locazione {locazione}{Environment.NewLine}{exc}", tipoLog.EXCEPTION); + } + } + } + hlComWarning.Visible = answ; + } + + /// + /// aggiorna il layout grafico + /// + private void updateLayout() + { + if (_IdxMacchina != "nd") + { + try + { + // in base allo stato recupero il colore... + string codColore = resoconti.mngr.semaforoDaIdxStato(resoconti.mngr.statoMacchina(_IdxMacchina)); + pnlMacchina.CssClass = codColore; + } + catch + { } + } + } + + /// + /// sistema il testo + /// + private void updateText() + { + if (!string.IsNullOrEmpty(_IdxMacchina) && _IdxMacchina != "nd") + { + // labels + lblCodArticolo.Text = "Art."; + lblStato.Text = "Stato"; + lblProd.Text = "T.Ciclo"; // era OEE + lblDurata.Text = "Durata"; + // 2018.02.05 cambio x fix nuovi impianti + // valMacchina.Text = tabMacchine.FindByIdxMacchina(IdxMacchina).Nome; + // valCodArticolo.Text = tabStatoMacchine.FindByIdxMacchina(IdxMacchina).CodArticolo; + + // leggo valori da MSE... + valMacchina.Text = tabMSE[0].Nome; + valCodArticolo.Text = tabMSE[0].CodArticolo; + // carico ultimo stato che sia durato almeno 6 sec (0.1 min) + int idxStato = 0; + int oreTot = 0; + float minuti = 0; + try + { + DS_ProdTempi.stp_repDonati_getLastStatoDurataMacchinaRow rigaStato = DataLayerObj.taDatiStatoMacch.GetData(IdxMacchina, 0.1)[0]; + idxStato = rigaStato.idxStato; + oreTot = Convert.ToInt32(Math.Floor(rigaStato.Minuti / 60)); + minuti = (float)rigaStato.Minuti - 60 * oreTot; + } + catch + { + // 2018.02.05 cambio x fix nuovi impianti + //idxStato = tabStatoMacchine.FindByIdxMacchina(IdxMacchina).IdxStato; + //DateTime inizioStato = tabStatoMacchine.FindByIdxMacchina(IdxMacchina).InizioStato; + //DateTime ora = DateTime.Now; + //TimeSpan durata = ora.Subtract(inizioStato); + //oreTot = durata.Days * 24 + durata.Hours; + //minuti = durata.Minutes; + idxStato = tabMSE[0].idxStato; + oreTot = (int)tabMSE[0].durata / 60; + minuti = (int)tabMSE[0].durata - 60 * oreTot; + } + // 2018.02.05 cambio x fix nuovi impianti + //valStato.Text = tabAnagStati.FindByIdxStato(idxStato).Descrizione; + valStato.Text = tabMSE[0].DescrizioneStato; + valDurata.Text = string.Format("{0}h {1}min", oreTot, minuti); + // solo se in stato NON di run... + if (idxStato != 13) + { + lblCausale.Text = "Causale fermo"; + string cauFermo = "nd"; + try + { + cauFermo = tabAnagStati.FindByIdxStato(tabMSE[0].idxStato).Descrizione; + //cauFermo = tabAnagStati.FindByIdxStato(Convert.ToInt32(tabStatoMacchine.FindByIdxMacchina(IdxMacchina).IdxStato)).Descrizione; + } + catch + { + // 2018.02.05 cambio x fix nuovi impianti + //cauFermo = string.Format("IN: {0}", tabStatoMacchine.FindByIdxMacchina(IdxMacchina).Value); + cauFermo = string.Format("IN: {0}", tabMSE[0].idxStato); + } + valCausale.Text = cauFermo; + } + else + { + lblCausale.Text = ""; + valCausale.Text = ""; + } + + // ATTENZIONE! dati generati casualmente, da cambiare in produzione!!! + bool demoRandom = false; + if (demoRandom) + { + // indico a caso % pz prodotti... + Random RandomClass = new Random(DateTime.Now.Millisecond); + if (idxStato == 13) + { + valProd.Text = string.Format("{0:P}", RandomClass.NextDouble() / 4 + 0.75); + } + else if (oreTot > 8) + { + valProd.Text = string.Format("{0:P}", 0); + } + else + { + valProd.Text = string.Format("{0:P}", RandomClass.NextDouble() / 2 + 0.25); + } + } + else // mostra lo stesso valore per tutti e due + { + // prova...se non ha dati relativa mostra n/a - not available + + DateTime Ora = DateTime.Now; + + valProd.Text = "1H: "; + string emptyVal = "n/a
"; + int numPezzi = 0; + // prova l'ultima ora + try + { + // conto num pezzi e divido 1h/pezzi + numPezzi = DataLayerObj.taTempiCicloRilevati.getByMacchinaPeriodo(IdxMacchina, Ora.AddHours(-1), Ora).Rows.Count; + if (numPezzi > 0) + { + valProd.Text += String.Format("{0:#.00}m
", Math.Round((double)60 / numPezzi, 3)); + } + else + { + valProd.Text += emptyVal; + } + } + catch + { + valProd.Text += emptyVal; + } + + // prova le ultime 8 ore + + valProd.Text += "8H: "; + numPezzi = 0; + try + { + // conto num pezzi e divido 1h/pezzi + numPezzi = DataLayerObj.taTempiCicloRilevati.getByMacchinaPeriodo(IdxMacchina, Ora.AddHours(-8), Ora).Rows.Count; + if (numPezzi > 0) + { + valProd.Text += String.Format("{0:#.00}m ", Math.Round((double)480 / numPezzi, 3)); + } + else + { + valProd.Text += emptyVal; + } + } + catch + { + valProd.Text += emptyVal; + } + } + } + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// rimanda alla pagina di dettaglio della macchina scelta + /// + /// + /// + protected void lnkMacchina_Click(object sender, EventArgs e) + { + if (linkActive) + { + memLayer.ML.setSessionVal("IdxMacchina", IdxMacchina); + Response.Redirect(string.Format("~/DettaglioMacchina?IdxMacchina={0}", IdxMacchina)); + } + } + + /// + /// caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + //updateMe(); + } + + /// + /// metto a posto l'immagine + /// + protected void updateImg() + { + string urlMacchina; + if (_IdxMacchina != "nd") + { + urlMacchina = $"~/images/macchine/{resoconti.mngr.urlMacchina(IdxMacchina)}"; + if (urlMacchina == "thumb_") + { + urlMacchina = "~/images/empty.png"; + } + else + { + imgThumb.ToolTip = resoconti.mngr.nomeMacchina(IdxMacchina); + } + + string fullPath = Server.MapPath(urlMacchina); + if (!File.Exists(fullPath)) + { + // metto default Steamware + urlMacchina = "~/images/macchine/Steamware.png"; + } + + imgThumb.ImageUrl = urlMacchina; } else { - valProd.Text += emptyVal; + urlMacchina = "~/images/empty.png"; + imgThumb.ImageUrl = urlMacchina; } - } - - catch - { - valProd.Text += emptyVal; - } - } - } - } - /// - /// rimanda alla pagina di dettaglio della macchina scelta - /// - /// - /// - protected void lnkMacchina_Click(object sender, EventArgs e) - { - if (linkActive) - { - memLayer.ML.setSessionVal("IdxMacchina", IdxMacchina); - Response.Redirect(string.Format("~/DettaglioMacchina?IdxMacchina={0}", IdxMacchina)); - } - } - /// - /// aggiorna il layout grafico - /// - private void updateLayout() - { - if (_IdxMacchina != "nd") - { - try + + #endregion Protected Methods + + #region Public Methods + + /// + /// aggiorna controllo + /// + public void updateMe() { - // in base allo stato recupero il colore... - string codColore = resoconti.mngr.semaforoDaIdxStato(resoconti.mngr.statoMacchina(_IdxMacchina)); - pnlMacchina.CssClass = codColore; - } - catch - { } - } - } - /// - /// sistema hyperLink - /// - private void updateHL() - { - bool answ = false; - int minuti = memLayer.ML.CRI("keepAliveMin"); - // controllo se il keep alive è oltre il termine... - DateTime lastKA = DateTime.Now.AddMinutes(-minuti); - if (_IdxMacchina != "nd") - { - string nomeVar = string.Format("KeepAlive:{0}", _IdxMacchina); - string redKey = memLayer.ML.redHash(nomeVar); - var _lastKA = memLayer.ML.getRSV(redKey); - if (_lastKA == null) - { - answ = true; - //cerco su DB... - try - { - var tabDati = DataLayerObj.taKeepAlive.getByIdxMacchina(_IdxMacchina); - if (tabDati.Rows.Count > 0) + //SE E SOLO SE ho una macchina e/o locazione... + if (!string.IsNullOrEmpty(IdxMacchina) && !IdxMacchina.Contains("#") && (locazione != "00")) { - lastKA = tabDati[0].DataOraServer; - answ = (lastKA.AddMinutes(minuti) < DateTime.Now); + // effettua update visualizzazione + try + { + retrieveData(); + updateLayout(); + updateText(); + updateImg(); + updateHL(); + // controllo se link attivo... + if (!_linkActive) + { + valMacchina.Enabled = false; + } + //logger.lg.scriviLog(string.Format("Retrieve: {0}", DateTime.Now.Subtract(tick).Milliseconds), tipoLog.INFO); + divSegnaposto.Visible = false; + } + catch (Exception exc) + { + logger.lg.scriviLog($"Eccezione in fase popolamento statoMacchina per IdxMacchina {IdxMacchina} - locazione {locazione}{Environment.NewLine}{exc}", tipoLog.EXCEPTION); + } + } + else + { + pnlMacchina.Visible = false; } - } - catch (Exception exc) - { - logger.lg.scriviLog($"Eccezione in updateHL per IdxMacchina {IdxMacchina} - locazione {locazione}{Environment.NewLine}{exc}", tipoLog.EXCEPTION); - } } - } - hlComWarning.Visible = answ; - } - /// - /// metto a posto l'immagine - /// - protected void updateImg() - { - string urlMacchina; - if (_IdxMacchina != "nd") - { - urlMacchina = $"~/images/macchine/{resoconti.mngr.urlMacchina(IdxMacchina)}"; - if (urlMacchina == "thumb_") - { - urlMacchina = "~/images/empty.png"; - } - else - { - imgThumb.ToolTip = resoconti.mngr.nomeMacchina(IdxMacchina); - } - imgThumb.ImageUrl = urlMacchina; - } - else - { - urlMacchina = "~/images/empty.png"; - imgThumb.ImageUrl = urlMacchina; - } - } - #endregion - - #region area public - - /// - /// Idx della macchina controllata - /// - public string IdxMacchina - { - get - { - return _IdxMacchina; - } - set - { - if (resoconti.mngr == null) - { - resoconti.mngr = new resoconti(); - } - _IdxMacchina = value; - _locazione = resoconti.mngr.locazioneDaIdx(_IdxMacchina); - updateMe(); - } + #endregion Public Methods } - /// - /// stringa locazione macchina in tabella - /// - public string locazione - { - get - { - return _locazione; - } - set - { - if (resoconti.mngr == null) - { - resoconti.mngr = new resoconti(); - } - _locazione = value; - try - { - _IdxMacchina = resoconti.mngr.idxDaLocazione(_locazione); - updateMe(); - } - catch - { - _IdxMacchina = "nd"; - } - } - } - /// - /// definisce se sia attivo il link della pagina - /// - public bool linkActive - { - get - { - return _linkActive; - } - set - { - _linkActive = value; - } - } - - #endregion - } } \ No newline at end of file