Aggiunta pagina SINGLE x monitor
http://localhost:56580/Machine/Status/L014
This commit is contained in:
@@ -24,12 +24,15 @@ namespace MP_MON.Controllers
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (pageRefreshSec == "") pageRefreshSec = "60";
|
||||
if (pageRefreshSec == "")
|
||||
{
|
||||
pageRefreshSec = "60";
|
||||
}
|
||||
|
||||
ViewBag.pageRefreshMs = pageRefreshMs;
|
||||
Response.AddHeader("Refresh", pageRefreshSec);
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Blink()
|
||||
{
|
||||
// ricarico ogni minuto COMUNQUE tutto...
|
||||
@@ -43,7 +46,11 @@ namespace MP_MON.Controllers
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (pageRefreshSec == "") pageRefreshSec = "60";
|
||||
if (pageRefreshSec == "")
|
||||
{
|
||||
pageRefreshSec = "60";
|
||||
}
|
||||
|
||||
ViewBag.pageRefreshMs = pageRefreshMs;
|
||||
Response.AddHeader("Refresh", pageRefreshSec);
|
||||
return View("Index");
|
||||
@@ -61,7 +68,11 @@ namespace MP_MON.Controllers
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (pageRefreshSec == "") pageRefreshSec = "60";
|
||||
if (pageRefreshSec == "")
|
||||
{
|
||||
pageRefreshSec = "60";
|
||||
}
|
||||
|
||||
ViewBag.pageRefreshMs = pageRefreshMs;
|
||||
Response.AddHeader("Refresh", pageRefreshSec);
|
||||
return View("Index");
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using MP_MON.Models;
|
||||
using Newtonsoft.Json;
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using SteamWare;
|
||||
using System.Data;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MP_MON.Controllers
|
||||
{
|
||||
@@ -15,8 +14,23 @@ namespace MP_MON.Controllers
|
||||
|
||||
// GET: StatusMap
|
||||
public ActionResult StatusMap(string baseCss)
|
||||
{
|
||||
return SingleStatus(baseCss, "");
|
||||
}
|
||||
|
||||
// GET: StatusMap
|
||||
public ActionResult SingleStatus(string baseCss, string IdxMacchina)
|
||||
{
|
||||
int dataRefresh = 2000;
|
||||
// salvo idxMacc in sessione se c'è...
|
||||
if (IdxMacchina != "" && IdxMacchina != null)
|
||||
{
|
||||
memLayer.ML.setSessionVal("IdxMacchina", IdxMacchina);
|
||||
}
|
||||
else
|
||||
{
|
||||
IdxMacchina = memLayer.ML.StringSessionObj("IdxMacchina");
|
||||
}
|
||||
try
|
||||
{
|
||||
dataRefresh = Convert.ToInt32(System.Web.Configuration.WebConfigurationManager.AppSettings["dataRefreshMs"]);
|
||||
@@ -26,14 +40,14 @@ namespace MP_MON.Controllers
|
||||
// cerco su REDIS...
|
||||
string hMSE = MapoDb.DataLayer.hMSE();
|
||||
string dataSer = memLayer.ML.getRSV(hMSE);
|
||||
List<MappaStatoExpl> dati= new List<MappaStatoExpl>();
|
||||
List<MappaStatoExpl> dati = new List<MappaStatoExpl>();
|
||||
if (dataSer != "" && dataSer != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
dati = JsonConvert.DeserializeObject<List<MappaStatoExpl>>(dataSer);
|
||||
}
|
||||
catch(Exception exc)
|
||||
catch (Exception exc)
|
||||
{
|
||||
dati = db.stp_MSE_getData(dataRefresh).ToList();
|
||||
logger.lg.scriviLog(string.Format("Recuperata MSE da DB{0}{1}", Environment.NewLine, exc));
|
||||
@@ -47,9 +61,12 @@ namespace MP_MON.Controllers
|
||||
dataSer = JsonConvert.SerializeObject(dati);
|
||||
// metto in redis
|
||||
memLayer.ML.setRSV(hMSE, dataSer, memLayer.ML.CRI("MSE_cacheDuration"));
|
||||
}
|
||||
}
|
||||
// filtro dati SOLO PER la macchina che mi interessa...
|
||||
dati = dati.Where(e => e.IdxMacchina == IdxMacchina).ToList();
|
||||
ViewBag.baseCss = baseCss;
|
||||
return PartialView("_StatusMap", dati);
|
||||
ViewBag.IdxMacchina = IdxMacchina;
|
||||
return PartialView("_StatusMapSingle", dati);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
using MP_MON.Models;
|
||||
using System.Web.Configuration;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace MP_MON.Controllers
|
||||
{
|
||||
public class MachineController : Controller
|
||||
{
|
||||
private MoonProEntities db = new MoonProEntities();
|
||||
/// <summary>
|
||||
/// Restituisce una view per SINGOLA macchina
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public ActionResult Index(string id)
|
||||
{
|
||||
// ricarico ogni minuto COMUNQUE tutto...
|
||||
string pageRefreshSec = "60";
|
||||
// refresh std ogni sec
|
||||
int pageRefreshMs = 1000;
|
||||
ViewBag.cssSemBase = "sem";
|
||||
try
|
||||
{
|
||||
pageRefreshSec = WebConfigurationManager.AppSettings["pageRefreshSec"];
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (pageRefreshSec == "")
|
||||
{
|
||||
pageRefreshSec = "60";
|
||||
}
|
||||
|
||||
ViewBag.pageRefreshMs = pageRefreshMs;
|
||||
Response.AddHeader("Refresh", pageRefreshSec);
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce una view per SINGOLA macchina
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public ActionResult Status(string id)
|
||||
{
|
||||
// ricarico ogni minuto COMUNQUE tutto...
|
||||
string pageRefreshSec = "60";
|
||||
// refresh std ogni sec
|
||||
int pageRefreshMs = 1000;
|
||||
ViewBag.cssSemBase = "sem";
|
||||
ViewBag.IdxMacchina = id;
|
||||
try
|
||||
{
|
||||
pageRefreshSec = WebConfigurationManager.AppSettings["pageRefreshSec"];
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (pageRefreshSec == "")
|
||||
{
|
||||
pageRefreshSec = "60";
|
||||
}
|
||||
|
||||
ViewBag.pageRefreshMs = pageRefreshMs;
|
||||
Response.AddHeader("Refresh", pageRefreshSec);
|
||||
return View();
|
||||
}
|
||||
#if false
|
||||
public ActionResult Blink()
|
||||
{
|
||||
// ricarico ogni minuto COMUNQUE tutto...
|
||||
string pageRefreshSec = "60";
|
||||
// se ho animazione refresh è ogni 2 sec...
|
||||
int pageRefreshMs = 2000;
|
||||
ViewBag.cssSemBase = "semBlink";
|
||||
try
|
||||
{
|
||||
pageRefreshSec = WebConfigurationManager.AppSettings["pageRefreshSec"];
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (pageRefreshSec == "")
|
||||
{
|
||||
pageRefreshSec = "60";
|
||||
}
|
||||
|
||||
ViewBag.pageRefreshMs = pageRefreshMs;
|
||||
Response.AddHeader("Refresh", pageRefreshSec);
|
||||
return View("Index");
|
||||
}
|
||||
public ActionResult Fix()
|
||||
{
|
||||
// ricarico ogni minuto COMUNQUE tutto...
|
||||
string pageRefreshSec = "60";
|
||||
// refresh std ogni sec
|
||||
int pageRefreshMs = 1000;
|
||||
ViewBag.cssSemBase = "semFix";
|
||||
try
|
||||
{
|
||||
pageRefreshSec = WebConfigurationManager.AppSettings["pageRefreshSec"];
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (pageRefreshSec == "")
|
||||
{
|
||||
pageRefreshSec = "60";
|
||||
}
|
||||
|
||||
ViewBag.pageRefreshMs = pageRefreshMs;
|
||||
Response.AddHeader("Refresh", pageRefreshSec);
|
||||
return View("Index");
|
||||
}
|
||||
#endif
|
||||
public ActionResult GetClock()
|
||||
{
|
||||
return PartialView("_mmClock");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,6 +140,7 @@
|
||||
<Compile Include="App_Start\BundleConfig.cs" />
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="Controllers\MachineController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\MSEController.cs" />
|
||||
<Compile Include="GlimpseSecurityPolicy.cs" />
|
||||
@@ -385,6 +386,9 @@
|
||||
<Content Include="Scripts\popper.js.map" />
|
||||
<Content Include="Scripts\popper-utils.min.js.map" />
|
||||
<Content Include="Scripts\popper-utils.js.map" />
|
||||
<Content Include="Views\Machine\Index.cshtml" />
|
||||
<Content Include="Views\Machine\Status.cshtml" />
|
||||
<Content Include="Views\MSE\_StatusMapSingle.cshtml" />
|
||||
<None Include="Web.OVH-demo.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</None>
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
@model IEnumerable<MP_MON.Models.MappaStatoExpl>
|
||||
|
||||
|
||||
<div class="row statusMap m-2">
|
||||
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
// fix codice semaforo: sVe -> Ve, sRo ->Ro...
|
||||
string codSemaf = item.Semaforo;
|
||||
if (codSemaf.Length == 3)
|
||||
{
|
||||
codSemaf = codSemaf.Substring(1, 2);
|
||||
}
|
||||
string cssStatus = ViewBag.baseCss + codSemaf;
|
||||
// calcolo durata...
|
||||
TimeSpan TCAss = TimeSpan.FromMinutes((double)item.TCAssegnato);
|
||||
TimeSpan TCLav = TimeSpan.FromMinutes((double)item.TCLavRT);
|
||||
// converto a stringa!
|
||||
string TCAssegnato = TCAss.ToString(@"mm\:ss");
|
||||
string TCLavorato = TCLav.ToString(@"mm\:ss");
|
||||
|
||||
// verifico SE è disabilitata modalità animazione -> blink a stati (e refresh 1s)
|
||||
if (System.Web.Configuration.WebConfigurationManager.AppSettings["doAnimate"] == "1")
|
||||
{
|
||||
// blink se secondo pari...
|
||||
DateTime adesso = DateTime.Now;
|
||||
int resto = 0;
|
||||
Math.DivRem(adesso.Second, 2, out resto);
|
||||
if (resto == 0)
|
||||
{
|
||||
cssStatus += "_b";
|
||||
}
|
||||
}
|
||||
// verifico se mostrare sarticolo o disegno...
|
||||
string sArticolo = "";
|
||||
if (System.Web.Configuration.WebConfigurationManager.AppSettings["sART"] == "CodArticolo")
|
||||
{
|
||||
sArticolo = item.CodArticolo;
|
||||
}
|
||||
else
|
||||
{
|
||||
sArticolo = item.Disegno;
|
||||
}
|
||||
// se fosse vuoto mostro cmq codArt tra parentesi...
|
||||
if (sArticolo == "")
|
||||
{
|
||||
sArticolo = string.Format("[{0}]", item.CodArticolo);
|
||||
}
|
||||
// se NON trova update da oltre 1 minuto rosso lo status comunicazione
|
||||
string cssComStatus = cssStatus;
|
||||
if (DateTime.Now.Subtract((DateTime)item.lastUpdate).TotalMinutes>1)
|
||||
{
|
||||
cssComStatus = ViewBag.baseCss + "Ro";
|
||||
}
|
||||
<div class="col-12" style="padding:2px; font-size:2.5em; line-height:1.5em;">
|
||||
<div class="@cssStatus p-1">
|
||||
@*noCpu*@
|
||||
<div class="row mb-1">
|
||||
<div class="col-12">
|
||||
<div class="ui-title text-uppercase">@Html.DisplayFor(modelItem => item.Nome)</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row pt-0 pb-2 px-1 fontSmall">
|
||||
<div class="col-4 pr-0">Art.</div>
|
||||
<div class="col-8 pl-0 text-right">@sArticolo</div>
|
||||
<div class="col-9 text-uppercase"><b>@Html.DisplayFor(modelItem => item.DescrizioneStato)</b></div>
|
||||
<div class="col-3 pl-0 text-right">@item.durata'</div>
|
||||
@*<div class="col-6 pr-0">OEE</div>
|
||||
<div class="col-6 pl-0 text-right">xx%</div>*@
|
||||
<div class="col-4 pr-0">T.Ciclo</div>
|
||||
<div class="col-4 pl-0 text-right">std: @TCAssegnato</div>
|
||||
<div class="col-4 pl-0 text-right">act: @TCLavorato</div>
|
||||
<div class="col-6 pr-0">Pezzi<sub>(prod/ord)</sub></div>
|
||||
<div class="col-6 pl-0 text-right">@Html.DisplayFor(modelItem => item.PezziProd) / @Html.DisplayFor(modelItem => item.NumPezzi)</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="@cssComStatus p-1">
|
||||
<div class="row fontSmaller mt-1">
|
||||
<div class="col-12">
|
||||
<div class="text-right ui-footer px-2">last update: @Html.DisplayFor(modelItem => item.lastUpdate)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,18 @@
|
||||
@model IEnumerable<MP_MON.Models.MappaStatoExpl>
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
}
|
||||
|
||||
<div id="mainDiv">
|
||||
@Html.Action("StatusMap", "MSE", new { baseCss = ViewBag.cssSemBase })
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function reloadData() {
|
||||
$("#mainDiv").load('@(Url.Action("StatusMap", "MSE", new { baseCss = ViewBag.cssSemBase }, Request.Url.Scheme))');
|
||||
}
|
||||
$(document).ready(function () {
|
||||
// ciclo reload infinito ogni secondo...
|
||||
myTimer = setInterval(reloadData, @ViewBag.pageRefreshMs);
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,18 @@
|
||||
@model IEnumerable<MP_MON.Models.MappaStatoExpl>
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
}
|
||||
|
||||
<div id="mainDiv">
|
||||
@Html.Action("SingleStatus", "MSE", new { baseCss = ViewBag.cssSemBase, IdxMacchina = ViewBag.IdxMacchina })
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function reloadData() {
|
||||
$("#mainDiv").load('@(Url.Action("SingleStatus", "MSE", new { baseCss = ViewBag.cssSemBase, IdxMacchina = ViewBag.IdxMacchina }, Request.Url.Scheme))');
|
||||
}
|
||||
$(document).ready(function () {
|
||||
// ciclo reload infinito ogni secondo...
|
||||
myTimer = setInterval(reloadData, @ViewBag.pageRefreshMs);
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user