abbozzato controllo recupero SeqStati
This commit is contained in:
@@ -543,6 +543,13 @@
|
||||
<Compile Include="WebUserControls\mod_sequencerStati.ascx.designer.cs">
|
||||
<DependentUpon>mod_sequencerStati.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\mod_sequencerStatiJS.ascx.cs">
|
||||
<DependentUpon>mod_sequencerStatiJS.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\mod_sequencerStatiJS.ascx.designer.cs">
|
||||
<DependentUpon>mod_sequencerStatiJS.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\mod_sequencerTempiCiclo.ascx.cs">
|
||||
<DependentUpon>mod_sequencerTempiCiclo.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -682,6 +689,7 @@
|
||||
<Content Include="Content\RobotoCondensed.woff">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="WebUserControls\mod_sequencerStatiJS.ascx" />
|
||||
<Content Include="WS\MPData.asmx" />
|
||||
<None Include="Properties\PublishProfiles\OVH-Demo.pubxml" />
|
||||
<None Include="Properties\PublishProfiles\IIS01.pubxml" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Web.Script.Services;
|
||||
using System.Web.Services;
|
||||
@@ -68,6 +69,71 @@ namespace MoonPro.WS
|
||||
Context.Response.Write(js.Serialize(items));
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
|
||||
public void seqStati(string idxMacch, string dataFrom, string dataTo)
|
||||
{
|
||||
JavaScriptSerializer js = new JavaScriptSerializer();
|
||||
Context.Response.Clear();
|
||||
Context.Response.ContentType = "application/json";
|
||||
|
||||
resoconti _resoconti = new resoconti();
|
||||
|
||||
intervalloDate intervallo = new intervalloDate();
|
||||
intervallo.fine = Convert.ToDateTime(dataTo);
|
||||
intervallo.inizio = Convert.ToDateTime(dataFrom);
|
||||
|
||||
#if false
|
||||
objSequencer datiSequencer = _resoconti.sequenzaDati(idxMacch, intervallo);
|
||||
foreach (DataLayer_generic.serieDatiRow item in datiSequencer.serieDati.Rows)
|
||||
{
|
||||
item.
|
||||
}
|
||||
#endif
|
||||
|
||||
int numVal = 1000;
|
||||
// genero numVal valori random inizio/fine...
|
||||
int maxMinutes = 5;
|
||||
Random random = new Random();
|
||||
visjsDsItem[] items = new visjsDsItem[numVal];
|
||||
DateTime lastDate = DateTime.Now.AddDays(-7);
|
||||
DateTime endDate;
|
||||
int lancio = 0;
|
||||
string currCSS = "sv";
|
||||
for (int i = 0; i < numVal; i++)
|
||||
{
|
||||
lancio = random.Next(10);
|
||||
if (lancio <= 7)
|
||||
{
|
||||
currCSS = "sv";
|
||||
}
|
||||
else if (lancio <= 8)
|
||||
{
|
||||
currCSS = "sg";
|
||||
}
|
||||
else
|
||||
{
|
||||
currCSS = "sr";
|
||||
}
|
||||
endDate = lastDate.AddSeconds(random.Next(maxMinutes * 60));
|
||||
items[i] = new visjsDsItem()
|
||||
{
|
||||
id = i,
|
||||
content = string.Format("Random data {0}", i),
|
||||
start = lastDate.ToString("yyyy-MM-dd HH:mm"),
|
||||
end = endDate.ToString("yyyy-MM-dd HH:mm"),
|
||||
group = "1", // per mostrare multi macchine
|
||||
type = "background", // importante x non vedere bordi...
|
||||
className = currCSS
|
||||
};
|
||||
lastDate = endDate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Context.Response.Write(js.Serialize(items));
|
||||
}
|
||||
[WebMethod]
|
||||
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
|
||||
public void getData()
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_sequencerStatiJS.ascx.cs" Inherits="MoonPro.WebUserControls.mod_sequencerStatiJS" %>
|
||||
|
||||
<div id="tlArea"></div>
|
||||
<asp:HiddenField runat="server" ID="hfIdxMacc" />
|
||||
<asp:HiddenField runat="server" ID="hfDataFrom" />
|
||||
<asp:HiddenField runat="server" ID="hfDataTo" />
|
||||
|
||||
<script type="text/javascript">
|
||||
// vedere: http://visjs.org/docs/timeline/
|
||||
$(document).ready(reloadData)
|
||||
// (ri)caricamento dati
|
||||
function reloadData() {
|
||||
// recupero valori hidden...
|
||||
var idxMacc = document.getElementById('<%=hfIdxMacc.UniqueID %>');
|
||||
var dataFrom = document.getElementById('<%=hfDataFrom.UniqueID %>');
|
||||
var dataTo = document.getElementById('<%=hfDataTo.UniqueID %>');
|
||||
// load e draw timeline
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/WS/MPData.asmx/seqStati?idxMacch=" + idxMacc + "&dataFrom=" + dataFrom + "&dataTo=" + dataTo,
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: plotSeqStati,
|
||||
error: plotSeqStati
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function plotSeqStati(response) {
|
||||
var output = response.responseText.replace("{\"d\":null}", "");
|
||||
|
||||
// recupero il container grafici
|
||||
var container = document.getElementById('tlArea');
|
||||
// ITES da deserializzazione risposta
|
||||
var items = JSON.parse(output);
|
||||
console.log(items);
|
||||
// gruppi
|
||||
var groups = [
|
||||
{
|
||||
id: 1
|
||||
, content: 'Stati'
|
||||
}
|
||||
];
|
||||
// Configuration for the Timeline
|
||||
var options = {
|
||||
stack: false
|
||||
, horizontalScroll: true
|
||||
, moveable: true
|
||||
, zoomable: true
|
||||
};
|
||||
// Crea la Timeline
|
||||
var timeline = new vis.Timeline(container, items, groups, options);
|
||||
// crea lo scatter dei TC
|
||||
var scatter = new vis.pl
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,61 @@
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace MoonPro.WebUserControls
|
||||
{
|
||||
public partial class mod_sequencerStatiJS : System.Web.UI.UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// caricamento pagina
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Idx macchina da plottare
|
||||
/// </summary>
|
||||
public string idxMacchina
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfIdxMacc.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfIdxMacc.Value = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Inizio periodo, formato yyyyMMdd
|
||||
/// </summary>
|
||||
public string DataFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfDataFrom.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfDataFrom.Value = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Fine periodo, formato yyyyMMdd
|
||||
/// </summary>
|
||||
public string DataTo
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfDataTo.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfDataTo.Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MoonPro.WebUserControls {
|
||||
|
||||
|
||||
public partial class mod_sequencerStatiJS {
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfIdxMacc.
|
||||
/// </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.HiddenField hfIdxMacc;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfDataFrom.
|
||||
/// </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.HiddenField hfDataFrom;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfDataTo.
|
||||
/// </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.HiddenField hfDataTo;
|
||||
}
|
||||
}
|
||||
+13
-11
@@ -1,10 +1,12 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/WebMasterPages/MAPO_refresh.Master" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="MoonPro.test" %>
|
||||
|
||||
<%@ Register Src="WebUserControls/mod_realtimeClock.ascx" TagName="mod_realtimeClock" TagPrefix="uc1" %>
|
||||
<%@ Register Src="~/WebUserControls/mod_sequencerStatiJS.ascx" TagPrefix="uc1" TagName="mod_sequencerStatiJS" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
|
||||
<uc1:mod_realtimeClock ID="mod_realtimeClock1" runat="server" />
|
||||
|
||||
<div id="timelineArea"></div>
|
||||
<%--<div id="timelineArea"></div>--%>
|
||||
<div id="tcArea"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -18,15 +20,15 @@
|
||||
|
||||
// (ri)caricamento dati
|
||||
function reloadData() {
|
||||
// load e draw timeline
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/WS/MPData.asmx/randomData?numVal=1000",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: plotSeqStati,
|
||||
error: plotSeqStati
|
||||
});
|
||||
//// load e draw timeline
|
||||
//$.ajax({
|
||||
// type: "GET",
|
||||
// url: "/WS/MPData.asmx/randomData?numVal=1000",
|
||||
// contentType: "application/json; charset=utf-8",
|
||||
// dataType: "json",
|
||||
// success: plotSeqStati,
|
||||
// error: plotSeqStati
|
||||
//});
|
||||
|
||||
// load e draw TC scatter
|
||||
$.ajax({
|
||||
@@ -153,5 +155,5 @@
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<uc1:mod_sequencerStatiJS runat="server" ID="mod_sequencerStatiJS" />
|
||||
</asp:Content>
|
||||
|
||||
Generated
+9
@@ -20,5 +20,14 @@ namespace MoonPro {
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::MoonPro.WebUserControls.mod_realtimeClock mod_realtimeClock1;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo mod_sequencerStatiJS.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::MoonPro.WebUserControls.mod_sequencerStatiJS mod_sequencerStatiJS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user