creato componente e spostato li i dati di visualizzazione
This commit is contained in:
@@ -76,15 +76,26 @@ namespace MP.Data.Controllers
|
||||
/// Elenco da tabella MappaStatoExpl
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.MappaStatoExpl> MseGetAll()
|
||||
public List<DatabaseModels.MappaStatoExpl> MseGetAll(int maxAge = 2000)
|
||||
{
|
||||
List<DatabaseModels.MappaStatoExpl> dbResult = new List<DatabaseModels.MappaStatoExpl>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
//dbResult = dbCtx
|
||||
//.DbSetMSE
|
||||
//.OrderBy(x => x.RowNum)
|
||||
//.ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var maxAgeSec = new SqlParameter("@maxAgeSec", maxAge);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetMSE
|
||||
.OrderBy(x => x.RowNum)
|
||||
.ToList();
|
||||
.DbSetMSE
|
||||
.FromSqlRaw("EXEC stp_MSE_getData @maxAgeSec", maxAgeSec)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,52 @@
|
||||
<h3>dettaglio macchina</h3>
|
||||
|
||||
@code {
|
||||
|
||||
@if (CurrRecord == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col machBlock">
|
||||
<div class="@cssStatus(CurrRecord.Semaforo) p-1">
|
||||
<div class="d-flex mb-1 ui-title justify-content-center align-items-center text-uppercase">
|
||||
@CurrRecord.Nome
|
||||
</div>
|
||||
<div class="d-flex justify-content-between pt-0 pb-2 px-1 fontSmall">
|
||||
<div class="px-1 pe-0">Art.</div>
|
||||
<div class="px-1 ps-0 ui-art">@CurrRecord.CodArticolo</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between pt-0 pb-2 px-1 fontSmall">
|
||||
<div class="px-1 text-uppercase"><b>@CurrRecord.DescrizioneStato</b></div>
|
||||
<div class="px-1 ps-0">@($"{CurrRecord.Durata:0.00}")'</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between pt-0 pb-2 px-1 fontSmall">
|
||||
@*<div class="col-6 pe-0">OEE</div>
|
||||
<div class="col-6 ps-0">xx%</div>*@
|
||||
<div class="px-1 pe-0">T.Ciclo</div>
|
||||
<div class="px-1 ps-0">std: @getMinSec(CurrRecord.TCAssegnato)</div>
|
||||
<div class="px-1 ps-0">act: @getMinSec(CurrRecord.TCLavRt)</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between pt-0 pb-2 px-1 fontSmall">
|
||||
<div class="px-1 pe-0">Pezzi<sub>(prod/ord)</sub></div>
|
||||
<div class="px-1 ps-0">@CurrRecord.PezziProd / @CurrRecord.NumPezzi</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="@cssComStatus(CurrRecord.Semaforo, CurrRecord.LastUpdate) p-1">
|
||||
<div class="row fontSmaller mt-1">
|
||||
<div class="col-12">
|
||||
<div class="text-right ui-footer px-2">
|
||||
<div class="row">
|
||||
@if (showComErr(CurrRecord.LastUpdate))
|
||||
{
|
||||
<div class="col text-warning">
|
||||
<b>C.101</b>
|
||||
</div>
|
||||
}
|
||||
<div class="col text-end">
|
||||
@CurrRecord.LastUpdate
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Mon;
|
||||
using MP.Mon.Shared;
|
||||
using MP.Mon.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
|
||||
namespace MP.Mon.Components
|
||||
{
|
||||
public partial class DetailMSE
|
||||
{
|
||||
|
||||
protected string baseCss = "";
|
||||
|
||||
[Parameter]
|
||||
public bool doAnimate { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public int keepAliveMin { get; set; } = 5;
|
||||
[Parameter]
|
||||
public MappaStatoExpl? CurrRecord { get; set; } = null;
|
||||
|
||||
private string cssStatus(string codSemaforo)
|
||||
{
|
||||
return $"{baseCss}{codSemaforo.Substring(1, 2)}";
|
||||
}
|
||||
|
||||
private string cssComStatus(string semaforo, DateTime? lastUpdateN)
|
||||
{
|
||||
DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1);
|
||||
string answ = cssStatus(semaforo);
|
||||
if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * 60 / 2))
|
||||
{
|
||||
answ = $"{baseCss}Ro";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
setupConf();
|
||||
}
|
||||
private void setupConf()
|
||||
{
|
||||
baseCss = doAnimate ? "semBlink" : "sem";
|
||||
}
|
||||
private bool showComErr(DateTime? lastUpdateN)
|
||||
{
|
||||
DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1);
|
||||
bool answ = false;
|
||||
if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * 60 / 2))
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private string getMinSec(decimal? currTimeMin)
|
||||
{
|
||||
string answ = "nd";
|
||||
TimeSpan tSpan = new TimeSpan(0);
|
||||
try
|
||||
{
|
||||
tSpan = TimeSpan.FromMinutes((double)currTimeMin);
|
||||
answ = tSpan.ToString("mm:ss");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,56 +26,10 @@
|
||||
int currIdx = 0;
|
||||
foreach (var macchina in ListMSE)
|
||||
{
|
||||
<div class="col px-1">
|
||||
<div class="@cssStatus(macchina.Semaforo) p-1">
|
||||
<div class="d-flex mb-1 ui-title justify-content-center align-items-center text-uppercase">
|
||||
@macchina.Nome
|
||||
</div>
|
||||
<div class="d-flex justify-content-between pt-0 pb-2 px-1 fontSmall">
|
||||
<div class="px-1 pe-0">Art.</div>
|
||||
<div class="px-1 ps-0 ui-art">@macchina.CodArticolo</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between pt-0 pb-2 px-1 fontSmall">
|
||||
<div class="px-1 text-uppercase"><b>@macchina.DescrizioneStato</b></div>
|
||||
<div class="px-1 ps-0">@($"{macchina.Durata:0.00}")'</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between pt-0 pb-2 px-1 fontSmall">
|
||||
@*<div class="col-6 pe-0">OEE</div>
|
||||
<div class="col-6 ps-0">xx%</div>*@
|
||||
<div class="px-1 pe-0">T.Ciclo</div>
|
||||
<div class="px-1 ps-0">std: @getMinSec(macchina.TCAssegnato)</div>
|
||||
<div class="px-1 ps-0">act: @getMinSec(macchina.TCLavRt)</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between pt-0 pb-2 px-1 fontSmall">
|
||||
<div class="px-1 pe-0">Pezzi<sub>(prod/ord)</sub></div>
|
||||
<div class="px-1 ps-0">@macchina.PezziProd / @macchina.NumPezzi</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="@cssComStatus(macchina.Semaforo, macchina.LastUpdate) p-1">
|
||||
<div class="row fontSmaller mt-1">
|
||||
<div class="col-12">
|
||||
<div class="text-right ui-footer px-2">
|
||||
<div class="row">
|
||||
@if (showComErr(macchina.LastUpdate))
|
||||
{
|
||||
<div class="col text-warning">
|
||||
<b>C.101</b>
|
||||
</div>
|
||||
}
|
||||
<div class="col text-end">
|
||||
@macchina.LastUpdate
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DetailMSE CurrRecord="@macchina" doAnimate="@doAnimate" keepAliveMin="@keepAliveMin"></DetailMSE>
|
||||
currIdx++;
|
||||
if (currIdx >= maxCol)
|
||||
{
|
||||
@*</div>
|
||||
<div class="row statusMap mx-1 my-1">*@
|
||||
currIdx = 0;
|
||||
@((MarkupString)"</div><div class=\"row statusMap mx-1 my-1\">")
|
||||
;
|
||||
@@ -85,7 +39,7 @@
|
||||
int currNum = (currIdx % maxCol);
|
||||
while (currNum < (maxCol))
|
||||
{
|
||||
@((MarkupString)"<div class=\"col px-1\"> </div>")
|
||||
@((MarkupString)"<div class=\"col machBlock\"> </div>")
|
||||
;
|
||||
currNum++;
|
||||
|
||||
|
||||
@@ -30,21 +30,11 @@ namespace MP.Mon.Pages
|
||||
|
||||
protected bool doAnimate = true; // leggere da conf?
|
||||
|
||||
//protected string baseCss = "sem";
|
||||
//protected string baseCss = "semBlink";
|
||||
protected string baseCss = "";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
setupConf();
|
||||
await reloadData();
|
||||
//return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
private void setupConf()
|
||||
{
|
||||
baseCss = doAnimate ? "semBlink" : "sem";
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MMDataService { get; set; }
|
||||
@@ -54,45 +44,5 @@ namespace MP.Mon.Pages
|
||||
ListMSE = await MMDataService.MseGetAll();
|
||||
}
|
||||
|
||||
private string cssStatus(string codSemaforo)
|
||||
{
|
||||
return $"{baseCss}{codSemaforo.Substring(1,2)}";
|
||||
}
|
||||
|
||||
private string cssComStatus(string semaforo, DateTime? lastUpdateN)
|
||||
{
|
||||
DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1);
|
||||
string answ = cssStatus(semaforo);
|
||||
if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * 60 / 2))
|
||||
{
|
||||
answ = $"{baseCss}Ro";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private bool showComErr(DateTime? lastUpdateN)
|
||||
{
|
||||
DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1);
|
||||
bool answ = false;
|
||||
if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * 60 / 2))
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private string getMinSec(decimal? currTimeMin)
|
||||
{
|
||||
string answ = "nd";
|
||||
TimeSpan tSpan = new TimeSpan(0);
|
||||
try
|
||||
{
|
||||
tSpan = TimeSpan.FromMinutes((double)currTimeMin);
|
||||
answ = tSpan.ToString("mm:ss");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,6 +166,9 @@ a,
|
||||
color: #CDCDCD;
|
||||
background: linear-gradient(270deg, rgba(10, 10, 10, 0.7), rgba(80, 80, 80, 0.7), rgba(10, 10, 10, 0.7));
|
||||
}
|
||||
.machBlock {
|
||||
padding: 0 2px 0 2px;
|
||||
}
|
||||
/* END: gestione layout dinamico mappa... */
|
||||
/* area semafori*/
|
||||
.semBlinkVe,
|
||||
|
||||
@@ -175,6 +175,10 @@ a, .btn-link {
|
||||
color: #CDCDCD;
|
||||
background: linear-gradient(270deg, rgba(10,10,10,0.7), rgba(80,80,80,0.7), rgba(10,10,10,0.7));
|
||||
}
|
||||
.machBlock
|
||||
{
|
||||
padding: 0 2px 0 2px;
|
||||
}
|
||||
/* END: gestione layout dinamico mappa... */
|
||||
/* area semafori*/
|
||||
.semBlinkVe,
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user