Aggiunto modulo check x

- dichiarazioni fermo necessarie
- dichiarazione controlli scaduti
This commit is contained in:
Samuele Locatelli
2023-12-11 19:41:22 +01:00
parent cbc0b58532
commit cb2162fed8
26 changed files with 398 additions and 59 deletions
@@ -0,0 +1,8 @@
@if (ShowInsFermata)
{
<button class="btn w-100 btn-lg flashingRed mb-2 p-3" @onclick="@GoToFermate"><i class="fa fa-lg fa-exclamation-triangle"></i> DICHIARARE FERMO <i class="fa fa-lg fa-exclamation-triangle"></i></button>
}
@if (ShowReqControls)
{
<button class="btn w-100 btn-lg flashingPurple mb-2 p-3" @onclick="GoToControls"><i class="fa fa-lg fa-flask"></i> EFFETTUARE CONTROLLO<i class="fa fa-lg fa-flask"></i></button>
}
@@ -0,0 +1,123 @@
using Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using MP_TAB_SERV.Shared;
namespace MP_TAB_SERV.Components
{
public partial class CheckControls
{
#region Public Properties
[Parameter]
public MappaStatoExpl? RecMSE { get; set; } = null;
#endregion Public Properties
#region Protected Properties
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
/// <summary>
/// Determina se dato lo stato dell'impianto si debba mostrare btn fermata perché
/// - fermo &gt; xx min (da web.config, es 20')
/// - impianto fermo (controllando idxStato: priorità &gt; 1)
/// </summary>
protected bool ShowInsFermata
{
get
{
bool answ = false;
int idxStato = 0;
double durata = 0;
int durMinWarning = SMServ.GetConfInt("durMinWarning");
if (RecMSE != null)
{
idxStato = RecMSE.IdxStato ?? 0;
durata = RecMSE.Durata ?? 0;
if (durata >= durMinWarning)
{
try
{
// in questo caso controllo idxStato... e recupero priorità se > 1 -->
// richiesta qualifica
answ = SMServ.GetStateRow(idxStato).Priorita > 1;
}
catch
{ }
}
}
return answ;
}
}
/// <summary>
/// Verifica necessità visualizzare il check controlli
/// </summary>
protected bool ShowReqControls
{
get
{
bool answ = false;
if (RecMSE != null)
{
// SE abilitata gestione controlli...
bool enableCtrl = SMServ.GetConfBool("enableControlli");
if (enableCtrl)
{
int intervalloControlli = SMServ.GetConfInt("intervalloControlli");
// cerco ultimo controllo fatto
DateTime lastControl = DateTime.Now.AddYears(-1);
try
{
var pUpd = Task.Run(async () =>
{
await Task.Delay(1);
var tabCtrls = await TabDServ.RegControlliLast(RecMSE.IdxMacchina);
if (tabCtrls != null && tabCtrls.Count > 0)
{
var thisRec = tabCtrls.FirstOrDefault();
if (thisRec != null)
{
lastControl = thisRec.DataOra;
if (Math.Abs(DateTime.Now.Subtract(lastControl).TotalMinutes) >= intervalloControlli)
{
answ = true;
}
}
}
});
pUpd.Wait();
}
catch
{ }
}
}
return answ;
}
}
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected void GoToControls()
{
NavMan.NavigateTo("controls");
}
protected void GoToFermate()
{
NavMan.NavigateTo("prod-stop");
}
#endregion Protected Methods
}
}
@@ -0,0 +1,63 @@
.flashingPurple {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsBlue;
transform: translateZ(0);
}
@keyframes flsBlue {
from {
color: #ffc107;
background-color: #7623c8;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #00b1ec;
/*border: 5px solid #ffc107;*/
}
}
.flashingRed {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsRed;
transform: translateZ(0);
}
@keyframes flsRed {
from {
color: #ffc107;
background-color: #c82332;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #ecb100;
/*border: 5px solid #ffc107;*/
}
}
.flashingBlue {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsBlue;
transform: translateZ(0);
}
@keyframes flsBlue {
from {
color: #ffc107;
background-color: #2323c8;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #00b1ec;
/*border: 5px solid #ffc107;*/
}
}
@@ -0,0 +1,71 @@
.flashingPurple {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsBlue;
transform: translateZ(0);
}
@keyframes flsBlue {
from {
color: #ffc107;
background-color: #7623c8;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #00b1ec;
/*border: 5px solid #ffc107;*/
}
}
.flashingRed {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsRed;
transform: translateZ(0);
}
@keyframes flsRed {
from {
color: #ffc107;
background-color: #c82332;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #ecb100;
/*border: 5px solid #ffc107;*/
}
}
.flashingBlue {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsBlue;
transform: translateZ(0);
}
@keyframes flsBlue {
from {
color: #ffc107;
background-color: #2323c8;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #00b1ec;
/*border: 5px solid #ffc107;*/
}
}
+1
View File
@@ -0,0 +1 @@
.flashingPurple{animation-duration:.75s;animation-timing-function:steps(2);animation-iteration-count:infinite;animation-direction:alternate;animation-play-state:running;animation-name:flsBlue;transform:translateZ(0);}@keyframes flsBlue{from{color:#ffc107;background-color:#7623c8;}to{color:#fff;background-color:#00b1ec;}}.flashingRed{animation-duration:.75s;animation-timing-function:steps(2);animation-iteration-count:infinite;animation-direction:alternate;animation-play-state:running;animation-name:flsRed;transform:translateZ(0);}@keyframes flsRed{from{color:#ffc107;background-color:#c82332;}to{color:#fff;background-color:#ecb100;}}.flashingBlue{animation-duration:.75s;animation-timing-function:steps(2);animation-iteration-count:infinite;animation-direction:alternate;animation-play-state:running;animation-name:flsBlue;transform:translateZ(0);}@keyframes flsBlue{from{color:#ffc107;background-color:#2323c8;}to{color:#fff;background-color:#00b1ec;}}
+4 -4
View File
@@ -45,28 +45,28 @@ namespace MP_TAB_SERV.Components
get => showInsert ? "Nascondi Controllo" : "Registra Controllo";
}
protected bool enableControlli { get; set; } = true;
protected List<RegistroControlliModel> ListComplete { get; set; } = new List<RegistroControlliModel>();
protected List<RegistroControlliModel> ListPaged { get; set; } = new List<RegistroControlliModel>();
[Inject]
protected MessageService MServ { get; set; } = null!;
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected bool enableControlli { get; set; } = true;
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
if (RecMSE != null)
{
enableControlli = SMServ.GetConfBool("enableControlli");
IdxMaccSel = RecMSE.IdxMacchina;
DateTime fine = DateTime.Today.AddDays(1);
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>6.16.2312.1117</Version>
<Version>6.16.2312.1119</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB_SERV</RootNamespace>
</PropertyGroup>
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<AlarmsMan RecMSE="CurrMSE"></AlarmsMan>
}
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ControlsMan RecMSE="CurrMSE"></ControlsMan>
}
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<DeclarMan RecMSE="CurrMSE"></DeclarMan>
}
+2 -3
View File
@@ -7,8 +7,7 @@
}
else
{
<div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<IobInfoMan idxMacch="@IdxMacc"></IobInfoMan>
}
+1
View File
@@ -8,6 +8,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false" IdxMacchSub="@IdxMaccSubSel"></MachineBlock>
<ProdConfirm RecMSE="CurrMSE" E_Updated="RefreshData" E_MachSel="SetMacc"></ProdConfirm>
<ProdStat RecMSE="CurrMSE"></ProdStat>
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<NotesMan RecMSE="CurrMSE"></NotesMan>
}
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false" IdxMacchSub="@IdxMaccSubSel"></MachineBlock>
<OdlMan RecMSE="CurrMSE" E_Updated="RefreshData" E_MachSel="SetMacc"></OdlMan>
}
+1
View File
@@ -8,6 +8,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ParamsMan RecMSE="CurrMSE"></ParamsMan>
}
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ProdPlanMan RecMSE="CurrMSE"></ProdPlanMan>
}
+2 -3
View File
@@ -8,9 +8,8 @@
}
else
{
<div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<NotesEditor @ref="noteEdit" Title="Dichiarazione Fermo Retroattiva + Commento" RecMSE="CurrMSE" CanSave="false" E_DateSel="SetDate"></NotesEditor>
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ScrapMan RecMSE="CurrMSE"></ScrapMan>
}
+1
View File
@@ -8,6 +8,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
@if (enableSchedaTecnica)
{
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<h2>Gestione Turni</h2>
<div class="my-2 d-flex justify-content-center">
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2312.1117</h4>
<h4>Versione: 6.16.2312.1119</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2312.1117
6.16.2312.1119
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2312.1117</version>
<version>6.16.2312.1119</version>
<url>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+4
View File
@@ -34,5 +34,9 @@
{
"outputFile": "Components/ProdPlanMan.razor.css",
"inputFile": "Components/ProdPlanMan.razor.less"
},
{
"outputFile": "Components/CheckControls.razor.css",
"inputFile": "Components/CheckControls.razor.less"
}
]
+69 -45
View File
@@ -54,51 +54,6 @@ namespace MP.Data.Controllers
return dbResult;
}
/// <summary>
/// Elenco operatori
/// </summary>
/// <returns></returns>
public List<AnagOperatoriModel> ElencoOperatori()
{
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbOperatori
.Where(s => s.MatrOpr > 0)
.AsNoTracking()
.OrderBy(x => x.MatrOpr)
.ToList();
}
return dbResult;
}
/// <summary>
/// login operatori
/// </summary>
/// /// <param name="matrOpr"></param>
/// /// <param name="authKey"></param>
/// <returns></returns>
public AnagOperatoriModel OperatoreSearch(int matrOpr, string authKey)
{
AnagOperatoriModel dbResult = null;
AnagOperatoriModel answ = new AnagOperatoriModel();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbOperatori
.Where(s => (s.MatrOpr > 0) && (s.MatrOpr == matrOpr) && (s.authKey == authKey))
.AsNoTracking()
.FirstOrDefault();
if (dbResult != null)
{
answ = dbResult;
}
}
return answ;
}
/// <summary>
/// Registrato ACK allarme
/// </summary>
@@ -560,6 +515,25 @@ namespace MP.Data.Controllers
return fatto;
}
/// <summary>
/// Elenco operatori
/// </summary>
/// <returns></returns>
public List<AnagOperatoriModel> ElencoOperatori()
{
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbOperatori
.Where(s => s.MatrOpr > 0)
.AsNoTracking()
.OrderBy(x => x.MatrOpr)
.ToList();
}
return dbResult;
}
//stp_DDB_getNextByMacchinaFrom
/// <summary>
/// Eliminazione record EventList (SE trovato)
@@ -1264,6 +1238,33 @@ namespace MP.Data.Controllers
return answ;
}
/// <summary>
/// login operatori
/// </summary>
/// ///
/// <param name="matrOpr"></param>
/// ///
/// <param name="authKey"></param>
/// <returns></returns>
public AnagOperatoriModel OperatoreSearch(int matrOpr, string authKey)
{
AnagOperatoriModel dbResult = null;
AnagOperatoriModel answ = new AnagOperatoriModel();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbOperatori
.Where(s => (s.MatrOpr > 0) && (s.MatrOpr == matrOpr) && (s.authKey == authKey))
.AsNoTracking()
.FirstOrDefault();
if (dbResult != null)
{
answ = dbResult;
}
}
return answ;
}
/// <summary>
/// Stato prod macchina
/// </summary>
@@ -1444,6 +1445,29 @@ namespace MP.Data.Controllers
return fatto;
}
/// Restituisce elenco Ultimi RC macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <param name="idxODL"></param>
/// <param name="dataFrom"></param>
/// <param name="dataTo"></param>
/// <returns></returns>
public List<RegistroControlliModel> RegControlliLast(string idxMacchina)
{
List<RegistroControlliModel> dbResult = new List<RegistroControlliModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
dbResult = dbCtx
.DbSetRegControlli
.FromSqlRaw("EXEC stp_RC_getLast @IdxMacchina", IdxMacc)
.AsNoTracking()
.ToList();
}
return dbResult;
}
/// <summary>
/// Aggiunta record RegistroScarti
/// </summary>
+36
View File
@@ -1942,6 +1942,42 @@ namespace MP.Data.Services
return result;
}
/// <summary>
/// Restituisce elenco ULTIMI RC x macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public async Task<List<RegistroControlliModel>> RegControlliLast(string idxMacchina)
{
// setup parametri costanti
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<RegistroControlliModel>? result = new List<RegistroControlliModel>();
// cerco in redis...
string currKey = $"{redisBaseKey}:RecContr:{idxMacchina}:LAST";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<RegistroControlliModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbTabController.RegControlliLast(idxMacchina);
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (result == null)
{
result = new List<RegistroControlliModel>();
}
sw.Stop();
Log.Debug($"RegControlliLast | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Registra controllo
/// </summary>