update x seqStati "legacy"

This commit is contained in:
Samuele E. Locatelli
2018-07-30 18:25:07 +02:00
parent 98fb4eba89
commit 2b4cfcd2e9
8 changed files with 279 additions and 120 deletions
+19 -18
View File
@@ -21,22 +21,23 @@
</div>
<uc1:mod_mainMap runat="server" ID="mod_mainMap" />
</div>
<%--<uc1:mod_realtimeClock runat="server" ID="mod_realtimeClock" />--%>
<uc1:mod_sequencerStatiJS runat="server" ID="mod_sequencerStatiJS2" numGG='<%# Convert.ToInt32(ddlNumgg.SelectedValue) %>' idxMacchina="0" numSplit="100" />
<%--<uc1:mod_sequencerStatiJS runat="server" ID="mod_sequencerStatiJS1" periodo='<%# intervalloAnalisi %>' idxMacchina="0" numSplit="1000" />--%>
<%--<asp:Repeater ID="repSeq" runat="server" OnItemDataBound="repSeq_ItemDataBound" DataSourceID="odsMappa">
<ItemTemplate>
<div style="float: left; clear: both; font-size: 0.8em; width: 70px; height: 36px; margin: 2px 0px; padding: 2px 4px; text-align: center;" class='<%# cssStatoMacchina(Eval("idxMacchina").ToString()) %>'>
<asp:LinkButton ID="lnkMacchina" runat="server" OnClick="lnkMacchina_Click" CommandArgument='<%# Eval("idxMacchina") %>'>
<asp:Label runat="server" ID="lblMacchina" Text='<%# nomeMacchina(Eval("idxMacchina").ToString()) %>' />
</asp:LinkButton></div><div style="float: left; padding: 2px; background-color: white;">
<uc1:mod_sequencerStati runat="server" ID="seqStato" identificativo='<%# Eval("idxMacchina") %>' intervallo='<%# intervalloAnalisi %>' graphHeight="32" />
</div>
</ItemTemplate>
</asp:Repeater>
<asp:ObjectDataSource ID="odsMappa" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="MapoDb.DS_applicazioneTableAdapters.StatoMacchineTableAdapter" FilterExpression="NOT idxMacchina LIKE '%#%'"></asp:ObjectDataSource>--%>
<%--<div style="text-align: center; margin: auto; padding: 5px; clear: both;">
<asp:Button ID="btnReload" runat="server" Text="FORZA CARICAMENTO DATI" OnClick="btnReload_Click" Font-Size="1.3em" Width="20em" />
</div>--%>
<div runat="server" id="divGraphJS">
<uc1:mod_sequencerStatiJS runat="server" ID="mod_sequencerStatiJS2" numGG='<%# Convert.ToInt32(ddlNumgg.SelectedValue) %>' idxMacchina="0" numSplit="100" />
</div>
<div runat="server" id="divGraphLegacy">
<asp:Repeater ID="repSeq" runat="server" OnItemDataBound="repSeq_ItemDataBound" DataSourceID="odsMappa">
<ItemTemplate>
<div style="float: left; clear: both; font-size: 0.8em; width: 70px; height: 36px; margin: 2px 0px; padding: 2px 4px; text-align: center;" class='<%# cssStatoMacchina(Eval("idxMacchina").ToString()) %>'>
<asp:LinkButton ID="lnkMacchina" runat="server" OnClick="lnkMacchina_Click" CommandArgument='<%# Eval("idxMacchina") %>'>
<asp:Label runat="server" ID="lblMacchina" Text='<%# nomeMacchina(Eval("idxMacchina").ToString()) %>' />
</asp:LinkButton></div><div style="float: left; padding: 2px; background-color: white;">
<uc1:mod_sequencerStati runat="server" ID="seqStato" identificativo='<%# Eval("idxMacchina") %>' intervallo='<%# intervalloAnalisi %>' graphHeight="32" />
</div>
</ItemTemplate>
</asp:Repeater>
<asp:ObjectDataSource ID="odsMappa" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="MapoDb.DS_applicazioneTableAdapters.StatoMacchineTableAdapter" FilterExpression="NOT idxMacchina LIKE '%#%'"></asp:ObjectDataSource>
<div style="text-align: center; margin: auto; padding: 5px; clear: both;">
<asp:Button ID="btnReload" runat="server" Text="FORZA CARICAMENTO DATI" OnClick="btnReload_Click" Font-Size="1.3em" Width="20em" />
</div>
</div>
</asp:Content>
+32 -8
View File
@@ -9,6 +9,15 @@ namespace MoonPro
{
public partial class MappaStatoSeq : System.Web.UI.Page
{
public bool enableGraphJS
{
get
{
return memLayer.ML.CRB("enableGraphJS");
}
}
public resoconti _resoconti;
public int numGg
{
@@ -79,15 +88,23 @@ namespace MoonPro
protected DS_applicazione.MacchineDataTable tabMacchine;
protected void Page_Load(object sender, EventArgs e)
{
//_resoconti = new resoconti();
//tabMacchine = MapoDb.DataLayer.obj.taMacchine.GetData();
divGraphJS.Visible = enableGraphJS;
divGraphLegacy.Visible = !enableGraphJS;
if (!enableGraphJS)
{
_resoconti = new resoconti();
tabMacchine = MapoDb.DataLayer.obj.taMacchine.GetData();
}
if (!Page.IsPostBack)
{
ddlNumgg.DataBind();
ddlNumgg.SelectedValue = memLayer.ML.confReadString("seq_gg");
// imposto date di intervallo
mod_sequencerStatiJS2.periodo = intervalloAnalisi;
mod_sequencerStatiJS2.numSplit = memLayer.ML.CRS("seq_numSpl");
if (enableGraphJS)
{
// imposto date di intervallo
mod_sequencerStatiJS2.periodo = intervalloAnalisi;
mod_sequencerStatiJS2.numSplit = memLayer.ML.CRS("seq_numSpl");
}
}
}
@@ -104,8 +121,9 @@ namespace MoonPro
sequencer.doUpdate();
sequencer.Visible = true;
}
catch
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Eccezione recupero dati{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
sequencer.Visible = false;
}
}
@@ -119,7 +137,10 @@ namespace MoonPro
protected void ddlNumgg_SelectedIndexChanged(object sender, EventArgs e)
{
mod_sequencerStatiJS2.numGG = Convert.ToInt32(ddlNumgg.SelectedValue);
if (enableGraphJS)
{
mod_sequencerStatiJS2.numGG = Convert.ToInt32(ddlNumgg.SelectedValue);
}
}
/// <summary>
/// recupera nome macchina da idx
@@ -158,7 +179,10 @@ namespace MoonPro
protected void btnReload_Click(object sender, EventArgs e)
{
mod_sequencerStatiJS2.periodo = intervalloAnalisi;
if (enableGraphJS)
{
mod_sequencerStatiJS2.periodo = intervalloAnalisi;
}
}
}
}
+45
View File
@@ -48,6 +48,15 @@ namespace MoonPro {
/// </remarks>
protected global::MoonPro.WebUserControls.mod_mainMap mod_mainMap;
/// <summary>
/// Controllo divGraphJS.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divGraphJS;
/// <summary>
/// Controllo mod_sequencerStatiJS2.
/// </summary>
@@ -56,5 +65,41 @@ namespace MoonPro {
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::MoonPro.WebUserControls.mod_sequencerStatiJS mod_sequencerStatiJS2;
/// <summary>
/// Controllo divGraphLegacy.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divGraphLegacy;
/// <summary>
/// Controllo repSeq.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater repSeq;
/// <summary>
/// Controllo odsMappa.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsMappa;
/// <summary>
/// Controllo btnReload.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnReload;
}
}
+12 -4
View File
@@ -69,6 +69,7 @@
<add key="minutiUpdateAdmin" value="5" />
<add key="showSeqStati" value="true" />
<add key="showSeqTC" value="true" />
<add key="enableGraphJS" value="false" />
<add key="codV" value="Lavora" />
<add key="codG" value="???" />
<add key="codR" value="Ferma" />
@@ -82,15 +83,22 @@
<add key="AutoCleanUpInterval" value="10" />
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
<!--DB 2016-->
<add key="DbConfConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
<!--<add key="DbConfConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
<add key="MoonProConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
<add key="PermessiConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
<add key="UtenteCdcConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=Donati_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
<add key="VocabolarioConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro_Vocabolario;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
<add key="VocabolarioConnectionString" value="Data Source=SQL2016DEV;Initial Catalog=MoonPro_Vocabolario;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />-->
<add key="DbConfConnectionString" value="Data Source=SQL2016PROD;Initial Catalog=JetCo_MoonPro_prod;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
<add key="MoonProConnectionString" value="Data Source=SQL2016PROD;Initial Catalog=JetCo_MoonPro_prod;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
<add key="PermessiConnectionString" value="Data Source=SQL2016PROD;Initial Catalog=JetCo_MoonPro_prod;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
<add key="UtenteCdcConnectionString" value="Data Source=SQL2016PROD;Initial Catalog=Jetco_Anagrafica_prod;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
<add key="VocabolarioConnectionString" value="Data Source=SQL2016PROD;Initial Catalog=Jetco_Vocabolario_prod;Persist Security Info=True;User ID=sa;Password=keyhammer16;" />
</appSettings>
<connectionStrings>
<add name="MoonProConnectionString" connectionString="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" providerName="System.Data.SqlClient" />
<add name="MapoDb.Properties.Settings.MoonProConnectionString" connectionString="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" providerName="System.Data.SqlClient" />
<!--<add name="MoonProConnectionString" connectionString="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" providerName="System.Data.SqlClient" />
<add name="MapoDb.Properties.Settings.MoonProConnectionString" connectionString="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" providerName="System.Data.SqlClient" />-->
<add name="MoonProConnectionString" connectionString="Data Source=SQL2016PROD;Initial Catalog=JetCo_MoonPro_prod;Persist Security Info=True;User ID=sa;Password=keyhammer16;" providerName="System.Data.SqlClient" />
<add name="MapoDb.Properties.Settings.MoonProConnectionString" connectionString="Data Source=SQL2016PROD;Initial Catalog=JetCo_MoonPro_prod;Persist Security Info=True;User ID=sa;Password=keyhammer16;" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<globalization uiCulture="it" culture="it-IT" enableClientBasedCulture="false" />
@@ -1,3 +1,5 @@
using MapoDb;
using Newtonsoft.Json;
using SteamWare;
using System;
using System.Web.UI.DataVisualization.Charting;
@@ -254,88 +256,119 @@ namespace MoonPro.WebUserControls
private void plottaGruppi(DataLayer_generic.serieDatiDataTable dati)
{
DataLayer_generic.serieDatiDataTable datiGrouped = new DataLayer_generic.serieDatiDataTable();
TableRow r = new TableRow();
double valMin = totale / numSplit;
double valRigaCum = 0.0;
double valR = 0.0;
double valG = 0.0;
double valV = 0.0;
double valB = 0.0;
double valS = 0.0;
DateTime _t_0 = new DateTime(9999, 1, 1);
string _mostCodArticolo = "";
int _maxVal = 0;
string colore;
foreach (DataLayer_generic.serieDatiRow riga in dati)
// verifico se ho i dati in cache REDIS...
double numGG = _grafico.intervallo.fine.Subtract(_grafico.intervallo.inizio).TotalDays;
logger.lg.scriviLog(string.Format("Richiesta dati legacySeq GROUPED per {0} gg", numGG));
string rKey = DataLayer.mHash(string.Format("legacySeq:spl_{0}:mac_{1}_{2}_{3}", numSplit, _grafico.idxMacchina, _grafico.intervallo.inizio.ToString("yyyyMMdd_HHmmss"), _grafico.intervallo.fine.ToString("yyyyMMdd_HHmmss")).Replace(" ", "_"));
bool needRecalc = true;
string redJson = memLayer.ML.getRSV(rKey);
// controllo se ho già in sessione un oggetto seq...
if (redJson != null && redJson != "")
{
// salvo prima data...
if (riga.timeData < _t_0)
try
{
_t_0 = riga.timeData;
needRecalc = false;
// deserializzo
datiGrouped = JsonConvert.DeserializeObject<DataLayer_generic.serieDatiDataTable>(redJson);
logger.lg.scriviLog("Recuperato " + rKey);
}
if (riga.valore > _maxVal)
catch
{
_maxVal = Convert.ToInt32(riga.valore);
_mostCodArticolo = riga.label;
}
valRigaCum = valRigaCum + riga.valore;
// accumulo valori...
switch (riga.colore)
}
if (needRecalc)
{
logger.lg.scriviLog(string.Format("INIZIO calcolo dati per {0}", rKey));
TableRow r = new TableRow();
double valMin = totale / numSplit;
double valRigaCum = 0.0;
double valR = 0.0;
double valG = 0.0;
double valV = 0.0;
double valB = 0.0;
double valS = 0.0;
DateTime _t_0 = new DateTime(9999, 1, 1);
string _mostCodArticolo = "";
int _maxVal = 0;
string colore;
foreach (DataLayer_generic.serieDatiRow riga in dati)
{
case "sVe":
valV = valV + riga.valore;
break;
case "sGi":
valG = valG + riga.valore;
break;
case "sRo":
valR = valR + riga.valore;
break;
case "sBl":
valB = valB + riga.valore;
break;
case "sGr":
valS = valS + riga.valore;
break;
}
// se è maggiore plotto...
if (valRigaCum >= valMin)
{
// determino il colore...
if (valV / valRigaCum >= minVerde)
// salvo prima data...
if (riga.timeData < _t_0)
{
colore = "sVe";
valV = 0.0;
_t_0 = riga.timeData;
}
else if (valR / valRigaCum >= minRosso)
if (riga.valore > _maxVal)
{
colore = "sRo";
valR = 0.0;
_maxVal = Convert.ToInt32(riga.valore);
_mostCodArticolo = riga.label;
}
else if (valS / valRigaCum >= minSpento)
valRigaCum = valRigaCum + riga.valore;
// accumulo valori...
switch (riga.colore)
{
colore = "sGr";
valS = 0.0;
case "sVe":
valV = valV + riga.valore;
break;
case "sGi":
valG = valG + riga.valore;
break;
case "sRo":
valR = valR + riga.valore;
break;
case "sBl":
valB = valB + riga.valore;
break;
case "sGr":
valS = valS + riga.valore;
break;
}
else if (valB / valRigaCum >= minSpento)
// se è maggiore plotto...
if (valRigaCum >= valMin)
{
colore = "sBl";
valB = 0.0;
}
else
{
colore = "sGi";
valG = 0.0;
}
// salvo riga dati
datiGrouped.AddserieDatiRow(valRigaCum, colore, _mostCodArticolo, _t_0);
// reset dei contatori...
valRigaCum = 0.0;
// determino il colore...
if (valV / valRigaCum >= minVerde)
{
colore = "sVe";
valV = 0.0;
}
else if (valR / valRigaCum >= minRosso)
{
colore = "sRo";
valR = 0.0;
}
else if (valS / valRigaCum >= minSpento)
{
colore = "sGr";
valS = 0.0;
}
else if (valB / valRigaCum >= minSpento)
{
colore = "sBl";
valB = 0.0;
}
else
{
colore = "sGi";
valG = 0.0;
}
// salvo riga dati
datiGrouped.AddserieDatiRow(valRigaCum, colore, _mostCodArticolo, _t_0);
// reset dei contatori...
valRigaCum = 0.0;
_t_0 = new DateTime(9999, 1, 1);
_mostCodArticolo = "";
_maxVal = 0;
_t_0 = new DateTime(9999, 1, 1);
_mostCodArticolo = "";
_maxVal = 0;
}
}
//registro fine
logger.lg.scriviLog(string.Format("FINE calcolo dati per {0}", rKey));
// salvo sequenza in REDIS...
string rData = JsonConvert.SerializeObject(datiGrouped);
// salvo in sessione l'oggetto... secondo durata impostata in web.config.. moltiplicata x numero gg...
memLayer.ML.setRSV(rKey, rData, 60 * memLayer.ML.CRI("seqCacheDurMin") * (int)numGG);
logger.lg.scriviLog(string.Format("Salvataggio in sessione {0} effettuato", rKey));
}
plottaDettaglio(datiGrouped);
}
+3 -2
View File
@@ -64,14 +64,15 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>ExtLib\Microsoft.ReportViewer.WinForms.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.5.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WebGrease, Version=1.6.5135.21930, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+11 -5
View File
@@ -1,13 +1,19 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="MapoDb.Properties.Settings.MoonProConnectionString"
connectionString="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;"
providerName="System.Data.SqlClient" />
<add name="MapoDb.Properties.Settings.MoonProConnectionString" connectionString="Data Source=SQL2016DEV;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer16;" providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+57 -16
View File
@@ -1,9 +1,11 @@
using MapoDb;
using Newtonsoft.Json;
using SteamWare;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web.Script.Serialization;
/// <summary>
/// Summary description for resoconti
@@ -22,6 +24,13 @@ public enum statoMacchina
/// </summary>
public struct objSequencer
{
/// <summary>
/// Macchina selezionata
/// </summary>
public string idxMacchina;
/// <summary>
/// Intervallo date
/// </summary>
public intervalloDate intervallo;
/// <summary>
/// serie dei dati da plottare
@@ -534,24 +543,56 @@ public class resoconti
objSequencer _sequenza = new objSequencer();
if (idxMacchina != null && idxMacchina != "")
{
_sequenza.serieDati = new DataLayer_generic.serieDatiDataTable();
// seleziono i dati...
MapoDb.DS_applicazione.DiarioDiBordoDataTable tabSeq = taDiarioDiBordo.GetSequenza(idxMacchina, _intervallo.inizio, _intervallo.fine);
foreach (MapoDb.DS_applicazione.DiarioDiBordoRow riga in tabSeq.Rows)
// verifico se ho i dati in cache REDIS...
double numGG = _intervallo.fine.Subtract(_intervallo.inizio).TotalDays;
logger.lg.scriviLog(string.Format("Richiesta dati legacySeq per {0} gg", numGG));
string rKey = DataLayer.mHash(string.Format("legacySeq:spl_{0}:mac_{1}_{2}_{3}", 0, idxMacchina, _intervallo.inizio.ToString("yyyyMMdd_HHmmss"), _intervallo.fine.ToString("yyyyMMdd_HHmmss")).Replace(" ", "_"));
bool needRecalc = true;
string redJson = memLayer.ML.getRSV(rKey);
// controllo se ho già in sessione un oggetto seq...
if (redJson != null && redJson != "")
{
_sequenza.serieDati.AddserieDatiRow(riga.DurataMinuti, semaforoDaIdxStato(riga.IdxStato), riga.CodArticolo, riga.InizioStato);
try
{
needRecalc = false;
// deserializzo
_sequenza = JsonConvert.DeserializeObject<objSequencer>(redJson);
logger.lg.scriviLog("Recuperato legacySeq " + rKey);
}
catch
{
}
}
// faccio trim x primo evento...
if (_sequenza.serieDati[0].timeData < _intervallo.inizio)
if (needRecalc)
{
_sequenza.serieDati[0].valore -= _intervallo.inizio.Subtract(_sequenza.serieDati[0].timeData).TotalMinutes;
_sequenza.serieDati[0].timeData = _intervallo.inizio;
logger.lg.scriviLog(string.Format("INIZIO calcolo dati per {0}", rKey));
// altrimenti procedo come al solito...
_sequenza.idxMacchina = idxMacchina;
_sequenza.serieDati = new DataLayer_generic.serieDatiDataTable();
// seleziono i dati...
MapoDb.DS_applicazione.DiarioDiBordoDataTable tabSeq = taDiarioDiBordo.GetSequenza(idxMacchina, _intervallo.inizio, _intervallo.fine);
foreach (MapoDb.DS_applicazione.DiarioDiBordoRow riga in tabSeq.Rows)
{
_sequenza.serieDati.AddserieDatiRow(riga.DurataMinuti, semaforoDaIdxStato(riga.IdxStato), riga.CodArticolo, riga.InizioStato);
}
// faccio trim x primo evento...
if (_sequenza.serieDati[0].timeData < _intervallo.inizio)
{
_sequenza.serieDati[0].valore -= _intervallo.inizio.Subtract(_sequenza.serieDati[0].timeData).TotalMinutes;
_sequenza.serieDati[0].timeData = _intervallo.inizio;
}
//...e ultimo evento...
int numValori = _sequenza.serieDati.Count - 1;
_sequenza.serieDati[numValori].valore = _intervallo.fine.Subtract(_sequenza.serieDati[numValori].timeData).TotalMinutes;
// salvo intervallo
_sequenza.intervallo = _intervallo;
logger.lg.scriviLog(string.Format("FINE calcolo dati per {0}", rKey));
// salvo sequenza in REDIS...
string rData = JsonConvert.SerializeObject(_sequenza);
// salvo in sessione l'oggetto... secondo durata impostata in web.config.. moltiplicata x numero gg...
memLayer.ML.setRSV(rKey, rData, 60 * memLayer.ML.CRI("seqCacheDurMin") * (int)numGG);
logger.lg.scriviLog(string.Format("Salvataggio in sessione legacySeq {0} effettuato", rKey));
}
//...e ultimo evento...
int numValori = _sequenza.serieDati.Count - 1;
_sequenza.serieDati[numValori].valore = _intervallo.fine.Subtract(_sequenza.serieDati[numValori].timeData).TotalMinutes;
// salvo intervallo
_sequenza.intervallo = _intervallo;
}
return _sequenza;
}
@@ -606,7 +647,7 @@ public class resoconti
}
else
{
int index = 0;
int index = 0;
// ciclo su tutte le macchine
var elMacchine = DataLayer.obj.taSelMacc.getAttive();
foreach (var item in elMacchine)
@@ -937,7 +978,7 @@ public class visjsDsOptions
/// <summary>
/// Data End
/// </summary>
public string end;
public string end;
}
/// <summary>
/// Oggetto timeline vis.js con gruppi + items