Update gestione macchine/fermi
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
<h3>Elenco Fermate</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
<div class="card text-bg-dark shadow mb-0">
|
||||
<div class="card-body p-2">
|
||||
@if (ListaFermate == null || ListaFermate.Count == 0)
|
||||
{
|
||||
<div class="alert alert-warning fs-4 mb-0">Nessun Record Trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in ListaFermate)
|
||||
{
|
||||
<ProdStopMan objCss="@item.CssClass" objIcon="@item.Icon" objTxt="@(item.label)" IdxEvento="@item.value" E_EventSelected="EventRecord"></ProdStopMan>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,169 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data;
|
||||
using MP.Data.DbModels;
|
||||
using MP.Data.Services;
|
||||
using MP.SPEC.Data;
|
||||
using MP.SPEC.Shared;
|
||||
using NLog.Layouts;
|
||||
using System.Threading;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class ListFerm
|
||||
{
|
||||
|
||||
[Parameter]
|
||||
public List<vSelEventiBCodeModel> ListaFermate { get; set; } = new List<vSelEventiBCodeModel>();
|
||||
|
||||
private bool isProcessing = false;
|
||||
|
||||
//[Inject]
|
||||
//protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
//[Inject]
|
||||
//protected TabDataService TabDServ { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Processo registrazione eventi
|
||||
/// </summary>
|
||||
/// <param name="IdxEv"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task EventRecord(int IdxEv)
|
||||
{
|
||||
isProcessing = true;
|
||||
await Task.Delay(500);
|
||||
#if false
|
||||
bool needReload = false;
|
||||
await Task.Delay(1);
|
||||
// salvo evento e processo...
|
||||
if (IdxEv > 0)
|
||||
{
|
||||
var rigaEvento = SMServ.GetEventRow(IdxEv);
|
||||
if (rigaEvento != null)
|
||||
{
|
||||
var rigaStato = TabDServ.StatoMacchina(IdxMacc);
|
||||
// processo evento...
|
||||
if (insRealtime)
|
||||
{
|
||||
DateTime adesso = DateTime.Now.Floor(TimeSpan.FromSeconds(1));
|
||||
EventListModel newRec = new EventListModel()
|
||||
{
|
||||
IdxMacchina = IdxMacc,
|
||||
InizioStato = adesso,
|
||||
IdxTipo = IdxEv,
|
||||
CodArticolo = rigaStato.CodArticolo,
|
||||
Value = "DRT",
|
||||
MatrOpr = MatrOpr,
|
||||
pallet = rigaStato.pallet
|
||||
};
|
||||
// se realtime
|
||||
await TabDServ.EvListInsert(newRec, MP.Core.Objects.Enums.tipoInputEvento.barcode);
|
||||
// resetta il microstato in modo da ricevere successive info HW
|
||||
await TabDServ.resetMicrostatoMacchina(IdxMacc);
|
||||
}
|
||||
else
|
||||
{
|
||||
needReload = true;
|
||||
// in primis disabilito insert...
|
||||
TabDServ.MacchinaSetInsEnab(IdxMacc, false);
|
||||
|
||||
// calcolo evento
|
||||
string evento = $"{IdxEv}";
|
||||
string commento = "";
|
||||
try
|
||||
{
|
||||
evento = rigaEvento.Nome.Replace("Barcode - ", "");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// genero stringa pseudo-univoca
|
||||
string codRich = $"{DateTime.Now:yyMMddHHmmss}-{IdxEv}";
|
||||
// x prima cosa scrivo un evento tipo "1" x chiudere la durata appena prima
|
||||
// dell'evento successivo
|
||||
try
|
||||
{
|
||||
// cerco da 1 sec DOPO evento...
|
||||
var tabNext = TabDServ.DDB_getNext(IdxMacc, DtRif.AddSeconds(1));
|
||||
|
||||
DateTime nextEvDT = tabNext != null ? tabNext.InizioStato : DateTime.Now.AddMinutes(-1);
|
||||
|
||||
// fix salvo la dichiarazione di chiusura
|
||||
commento = $"999 - M.Lav EndEvt: {evento} [{codRich}]";
|
||||
// 1 hard-coded x resettare
|
||||
EventListModel newRec = new EventListModel()
|
||||
{
|
||||
IdxMacchina = IdxMacc,
|
||||
InizioStato = nextEvDT.AddSeconds(-1),
|
||||
IdxTipo = 1,
|
||||
CodArticolo = rigaStato.CodArticolo,
|
||||
Value = commento,
|
||||
MatrOpr = MatrOpr,
|
||||
pallet = rigaStato.pallet
|
||||
};
|
||||
await TabDServ.EvListInsert(newRec, MP.Core.Objects.Enums.tipoInputEvento.barcode);
|
||||
|
||||
// update commento apertura!
|
||||
commento = $"999 - Dich StartEvt: {evento} [{codRich}]";
|
||||
newRec = new EventListModel()
|
||||
{
|
||||
IdxMacchina = IdxMacc,
|
||||
InizioStato = DtRif.AddSeconds(1),
|
||||
IdxTipo = IdxEv,
|
||||
CodArticolo = rigaStato.CodArticolo,
|
||||
Value = commento,
|
||||
MatrOpr = MatrOpr,
|
||||
pallet = rigaStato.pallet
|
||||
};
|
||||
await TabDServ.EvListInsert(newRec, MP.Core.Objects.Enums.tipoInputEvento.barcode);
|
||||
// eseguo ricalcolo!
|
||||
DateTime startRicalcolo = DtRif.AddMinutes(minAnticipoRicalcolo);
|
||||
// eseguo ricalcolo periodo..
|
||||
await TabDServ.DDB_DoRecalc(IdxMacc, startRicalcolo, 1, rdm_nEvStep, rdm_nEvCheck, rdm_ChkOnly);
|
||||
// chiamo registrazione commento...
|
||||
if (noteEdit != null)
|
||||
{
|
||||
await noteEdit.ForceSave(DtRif.AddSeconds(5));
|
||||
DtRif = DateTime.Now;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in fase di riqualifica fermi{Environment.NewLine}{exc}");
|
||||
}
|
||||
|
||||
// riabilito insert... anche se non dovrebbe servire x stored ricalcolo precedente...
|
||||
TabDServ.MacchinaSetInsEnab(IdxMacc, true);
|
||||
}
|
||||
// mostro esito
|
||||
alertCss = "alert-primary";
|
||||
titleOut = rigaEvento.Nome;
|
||||
lblOut = $"Registrata dichiarazione fermata alle {DateTime.Now:HH:mm:ss}";
|
||||
}
|
||||
else
|
||||
{
|
||||
alertCss = "alert-warning";
|
||||
lblOut = $"Codice evento non valido! {IdxEv}";
|
||||
}
|
||||
}
|
||||
// faccio refresh x singola macchina 2019.03.26
|
||||
await TabDServ.RicalcMse(IdxMacc, 0);
|
||||
// rileggo e salvo..
|
||||
var ListMSE = await MDataService.MseGetAll(true);
|
||||
if (ListMSE != null)
|
||||
{
|
||||
// salvo in LocalStorage...
|
||||
await MsgServ.SaveMse(ListMSE);
|
||||
// aggiorno MSE attuale
|
||||
CurrMSE = ListMSE.Find(x => x.IdxMacchina == IdxMacc);
|
||||
}
|
||||
isProcessing = false;
|
||||
// se non era realtime --> rimando a commenti
|
||||
if (needReload)
|
||||
{
|
||||
await MsgServ.LastOpenedPageSet("notes");
|
||||
NavMan.NavigateTo("notes");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (ListRecords != null)
|
||||
@if (ListRecords == null || ListRecords.Count==0)
|
||||
{
|
||||
<div class="alert alert-warning fs-3">Nessun Record Trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped small">
|
||||
<thead>
|
||||
@@ -71,6 +75,5 @@
|
||||
</tfoot>
|
||||
</table>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -10,6 +10,10 @@ namespace MP.SPEC.Components
|
||||
[Parameter]
|
||||
public List<MacchineModel> ListMSE { get; set; } = null!;
|
||||
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<List<string>> EC_Selected { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
@@ -84,12 +88,10 @@ namespace MP.SPEC.Components
|
||||
CurrList.Clear();
|
||||
}
|
||||
await Task.Delay(1);
|
||||
#if false
|
||||
await EC_ListUpdated.InvokeAsync(CurrList);
|
||||
#endif
|
||||
await EC_Selected.InvokeAsync(CurrList);
|
||||
}
|
||||
|
||||
protected void ToggleSel(string newVal)
|
||||
protected async Task ToggleSel(string newVal)
|
||||
{
|
||||
if (!CurrList.Contains(newVal))
|
||||
{
|
||||
@@ -101,6 +103,8 @@ namespace MP.SPEC.Components
|
||||
}
|
||||
// riordino
|
||||
CurrList = CurrList.OrderBy(x => x).ToList();
|
||||
// invio selezione!
|
||||
await EC_Selected.InvokeAsync(CurrList);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<div class=" col-4 col-sm-4 col-md-4 col-lg-2 flex-fill2">
|
||||
<div class="p-2 h-100 w-100">
|
||||
<div class="@objCss text-center card w-100 h-100" @onclick="() => ReportSelected()">
|
||||
<div class="card-body text-light">
|
||||
<i class="@objIcon" style="font-size: 8vw"></i>
|
||||
</div>
|
||||
<div class="card-footer text-center h-100 bg-dark text-light opacity-75 p-1">
|
||||
@* <span class="d-inline-block text-center text-nowrap text-truncate mw-100 scroll-left" style="font-size: 1.3rem;">@objTxt</span> *@
|
||||
<div class="d-inline-block @textCss(objTxt)" style="font-size: 1.3rem;">
|
||||
<span>@objTxt</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,79 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class ProdStopMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> E_EventSelected { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int IdxEvento { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public string objCss { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string objIcon { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string objTxt { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration config { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
maxChar4Scroll = config.GetValue<int>("ServerConf:maxChar4Scroll");
|
||||
}
|
||||
|
||||
protected async Task ReportSelected()
|
||||
{
|
||||
await E_EventSelected.InvokeAsync(IdxEvento);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CSS class x testo (se descr lunga scorre...)
|
||||
/// </summary>
|
||||
protected string textCss(string currText)
|
||||
{
|
||||
string answ = " text-nowrap text-truncate w-100";
|
||||
if (currText.Length > maxChar4Scroll)
|
||||
{
|
||||
// calcolo delta... a-b-c con 5-10-oltre
|
||||
int delta = currText.Length - maxChar4Scroll;
|
||||
if (delta < 5)
|
||||
{
|
||||
answ = " scroll-left-a";
|
||||
}
|
||||
else if (delta < 10)
|
||||
{
|
||||
answ = " scroll-left-b";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = " scroll-left-c";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int maxChar4Scroll = 20;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<ListMacc ListMSE="@SearchRecords"></ListMacc>
|
||||
<ListMacc ListMSE="@SearchRecords" ></ListMacc>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<ListFerm></ListFerm>
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2602.2415</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
<b>Ultime modifiche:</b>
|
||||
<ul>{{LAST-CHANGES}}</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b>v.6.15.* →</b>
|
||||
<ul>
|
||||
<li>Prima release dotnet6</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div>
|
||||
<div style="float: left;">
|
||||
<img src="logoSteamware.png" />
|
||||
</div>
|
||||
<div style="float: right;">
|
||||
<a href="https://www.steamware.net/IOT" target="_blank">© Steamware 2006-2023</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -71,7 +71,8 @@
|
||||
".utdata": "application/octet-stream",
|
||||
".utprobe": "application/octet-stream",
|
||||
".utwedge": "application/octet-stream"
|
||||
}
|
||||
},
|
||||
"maxChar4Scroll": 21
|
||||
},
|
||||
"SpecialConf": {
|
||||
"AppUrl": "/MP/SPEC",
|
||||
|
||||
Reference in New Issue
Block a user