Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop
This commit is contained in:
@@ -97,7 +97,7 @@ namespace MP_TAB_SERV.Components
|
||||
if (RecMSE != null)
|
||||
{
|
||||
IdxMaccSel = RecMSE.IdxMacchina;
|
||||
CurrPeriodo = new Periodo(PeriodSet.LastWeek);
|
||||
CurrPeriodo = new Periodo(PeriodSet.ThisWeek);
|
||||
await doUpdate();
|
||||
}
|
||||
var rawDest = config.GetValue<string>("AlarmDest");
|
||||
|
||||
@@ -1,5 +1,103 @@
|
||||
<h3>ControlsMan</h3>
|
||||
<EgwCoreLib.Razor.PeriodoSel CurrPeriodo="CurrPeriodo" E_PeriodoSel="SetPeriodo"></EgwCoreLib.Razor.PeriodoSel>
|
||||
|
||||
@code {
|
||||
<ShowProcessing Message="Caricamento" IsProcessing="@isProcessing"></ShowProcessing>
|
||||
<div class="card">
|
||||
<div class="card-header bg-dark">
|
||||
<button class="btn btn-primary btn-lg text-light w-100" @onclick="ToggleBtn">
|
||||
<i class="fa fa-wrench"></i> @ConfTitle
|
||||
</button>
|
||||
@if (showInsert)
|
||||
{
|
||||
@if (showNote)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="">
|
||||
@* </div>
|
||||
<div class="form-floating"> *@
|
||||
<label class="form-label text-light">Note controllo NON superato (opzionali)</label>
|
||||
<textarea class="form-control" @bind="@noteKo" style="height: 6rem;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<button class="btn btn-danger btn-lg w-100" @onclick="SaveKo">Conferma controllo KO</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row my-2">
|
||||
<div class="col-6">
|
||||
<button class="btn btn-success w-100" @onclick="SaveOk">OK</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button class="btn btn-danger w-100" @onclick="ShowKo">KO</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="card-body bg-secondary p-1">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
}
|
||||
<table class="table table-dark table-sm table-striped">
|
||||
<thead>
|
||||
<tr class="text-start1">
|
||||
<th>
|
||||
Elenco Controlli
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListPaged)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<div class="row">
|
||||
<div class="col-5 small">
|
||||
<div>
|
||||
Art: <b>@item.CodArticolo</b>
|
||||
</div>
|
||||
<div>
|
||||
ODL: <b>@($"ODL{item.IdxOdl:000000000}")</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 px-0 text-center">
|
||||
@if (item.EsitoOk)
|
||||
{
|
||||
<i runat="server" class="fa fa-check-circle fs-1 text-success" aria-hidden="true"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i runat="server" class="fa fa-ban fs-1 text-danger" aria-hidden="true"></i>
|
||||
}
|
||||
</div>
|
||||
<div class="col-5 text-end small">
|
||||
<div class="text-truncate">
|
||||
@($"{item.DataOra:ddd dd.MM.yy HH:mm:ss}") <i class="fa fa-clock-o" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="text-truncate">
|
||||
<b>@item.Operatore</b>
|
||||
<i class="fa fa-user" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 small">
|
||||
@if (!string.IsNullOrEmpty(item.Note))
|
||||
{
|
||||
<div class="text-warning">@item.Note</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cad-footer">
|
||||
<EgwCoreLib.Razor.DataPager currPage="@PageNum" PageSize="@NumRecPage" totalCount="@TotalCount" numPageChanged="SavePage" numRecordChanged="SaveNumRec"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,176 @@
|
||||
using global::Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.Services;
|
||||
using NLog;
|
||||
using static EgwCoreLib.Utils.DtUtils;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class ControlsMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public MappaStatoExpl? RecMSE { get; set; } = null;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorno valori produzione alla data richiesta...
|
||||
/// </summary>
|
||||
/// <param name="newDate"></param>
|
||||
public async Task doUpdate()
|
||||
{
|
||||
isProcessing = true;
|
||||
await Task.Delay(1);
|
||||
if (!string.IsNullOrEmpty(IdxMaccSel))
|
||||
{
|
||||
ListComplete = await TabDServ.RegControlliFilt(IdxMaccSel, idxOdl, CurrPeriodo.Inizio, CurrPeriodo.Fine, false);
|
||||
TotalCount = ListComplete.Count;
|
||||
// esegue paginazione
|
||||
UpdateTable();
|
||||
}
|
||||
isProcessing = false;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int idxOdl = 0;
|
||||
protected bool isProcessing = false;
|
||||
protected string noteKo = "";
|
||||
protected int NumRecPage = 10;
|
||||
protected int PageNum = 1;
|
||||
protected bool showNote = false;
|
||||
protected int TotalCount = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string ConfTitle
|
||||
{
|
||||
get => showInsert ? "Nascondi Controllo" : "Registra Controllo";
|
||||
}
|
||||
|
||||
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!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
if (RecMSE != null)
|
||||
{
|
||||
IdxMaccSel = RecMSE.IdxMacchina;
|
||||
CurrPeriodo = new Periodo(PeriodSet.ThisWeek);
|
||||
await doUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task SaveKo()
|
||||
{
|
||||
isProcessing = true;
|
||||
await TabDServ.RegControlliInsert(IdxMaccSel, MServ.MatrOpr, false, noteKo, DateTime.Now);
|
||||
showInsert = false;
|
||||
showNote = false;
|
||||
await doUpdate();
|
||||
isProcessing = false;
|
||||
}
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
NumRecPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected async Task SaveOk()
|
||||
{
|
||||
isProcessing = true;
|
||||
await TabDServ.RegControlliInsert(IdxMaccSel, MServ.MatrOpr, true, noteKo, DateTime.Now);
|
||||
showInsert = false;
|
||||
showNote = false;
|
||||
await doUpdate();
|
||||
isProcessing = false;
|
||||
}
|
||||
|
||||
protected void SavePage(int newNum)
|
||||
{
|
||||
PageNum = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected async Task SetMacc(string selIdxMacc)
|
||||
{
|
||||
isProcessing = true;
|
||||
await Task.Delay(10);
|
||||
IdxMaccSel = selIdxMacc;
|
||||
await doUpdate();
|
||||
isProcessing = false;
|
||||
await Task.Delay(10);
|
||||
}
|
||||
|
||||
protected async Task SetPeriodo(Periodo newPeriodo)
|
||||
{
|
||||
CurrPeriodo = newPeriodo;
|
||||
await doUpdate();
|
||||
}
|
||||
|
||||
protected void ShowKo()
|
||||
{
|
||||
showNote = true;
|
||||
}
|
||||
|
||||
protected void ToggleBtn()
|
||||
{
|
||||
showInsert = !showInsert;
|
||||
if (showInsert)
|
||||
{
|
||||
noteKo = "";
|
||||
showNote = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void UpdateTable()
|
||||
{
|
||||
// esegue paginazione
|
||||
if (TotalCount > NumRecPage)
|
||||
{
|
||||
ListPaged = ListComplete.Skip((PageNum - 1) * NumRecPage).Take(NumRecPage).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListPaged = ListComplete;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private bool showInsert = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private Periodo CurrPeriodo { get; set; } = new Periodo();
|
||||
private string IdxMaccSel { get; set; } = "";
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -174,11 +174,16 @@ else
|
||||
<div class="col-4"><i class="fa-solid fa-layer-group"></i></div>
|
||||
<div class="col-8">@($"{RecMSE.PezziProd:N0}")</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center text-light d-flex justify-content-between">
|
||||
<div class="col-4"><span>ART.</span></div>
|
||||
<div class="col-8">@RecMSE.CodArticolo</div>
|
||||
</div>
|
||||
<div class="text-center text-light d-flex justify-content-between small">
|
||||
<div class="col-4">ORD.</div>
|
||||
<div class="col-8">@($"ODL{RecMSE.IdxOdl:00000000}")</div>
|
||||
@* <div class="col-6">@($"PODL{RecMSE.IdxPOdl:00000000}")</div>
|
||||
<div class="col-6">@($"ODL{RecMSE.IdxOdl:00000000}")</div> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>
|
||||
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
|
||||
</div>
|
||||
<ControlsMan></ControlsMan>
|
||||
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
|
||||
<ControlsMan RecMSE="CurrMSE"></ControlsMan>
|
||||
}
|
||||
|
||||
@@ -20,11 +20,10 @@
|
||||
<i class="fa-solid fa-house"></i>
|
||||
MapoTAB2
|
||||
|
||||
<img src="/images/LogoSteamware.png" style="height: 1rem" />
|
||||
<img src="images/LogoSteamware.png" style="height: 1rem" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-4 text-end">
|
||||
@*<button class="btn btn-sm btn-dark" @onclick="() => OnYes()">Yes!</button>*@
|
||||
<div class="row w-100 slideMen">
|
||||
<div class="p-0">
|
||||
<SlideMenu MenuItems="@CurrMenuItems"></SlideMenu>
|
||||
|
||||
@@ -461,13 +461,12 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
//stp_DDB_getNextByMacchinaFrom
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_configuration = null;
|
||||
}
|
||||
|
||||
//stp_DDB_getNextByMacchinaFrom
|
||||
/// <summary>
|
||||
/// Eliminazione record EventList (SE trovato)
|
||||
/// </summary>
|
||||
@@ -626,8 +625,6 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
//stp_STM_setInsEnabled
|
||||
|
||||
/// <summary>
|
||||
/// MicroStato macchina (da key)
|
||||
/// </summary>
|
||||
@@ -647,6 +644,7 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
//stp_STM_setInsEnabled
|
||||
/// <summary>
|
||||
/// Stato macchina - tutte
|
||||
/// </summary>
|
||||
@@ -700,6 +698,62 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco RC filtrato
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="idxODL"></param>
|
||||
/// <param name="dataFrom"></param>
|
||||
/// <param name="dataTo"></param>
|
||||
/// <returns></returns>
|
||||
public List<RegistroControlliModel> RegControlliFilt(string idxMacchina, int idxODL, DateTime dataFrom, DateTime dataTo, bool showMulti)
|
||||
{
|
||||
List<RegistroControlliModel> dbResult = new List<RegistroControlliModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var IdxODL = new SqlParameter("@IdxODL", idxODL);
|
||||
var DataFrom = new SqlParameter("@DataFrom", dataFrom);
|
||||
var DataTo = new SqlParameter("@DataTo", dataTo);
|
||||
var ShowMulti = new SqlParameter("@showMulti", showMulti);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetRegControlli
|
||||
.FromSqlRaw("EXEC stp_RC_getByFilt @IdxMacchina, @IdxODL, @DataFrom, @DataTo, @ShowMulti", IdxMacc, IdxODL, DataFrom, DataTo, ShowMulti)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra controllo
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="matrOpr"></param>
|
||||
/// <param name="esitoOk"></param>
|
||||
/// <param name="note"></param>
|
||||
/// <param name="dataOra"></param>
|
||||
/// <returns></returns>
|
||||
public bool RegControlliInsert(string idxMacchina, int matrOpr, bool esitoOk, string note, DateTime dataOra)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var MatrOpr = new SqlParameter("@MatrOpr", matrOpr);
|
||||
var EsitoOk = new SqlParameter("@EsitoOk", esitoOk);
|
||||
var Note = new SqlParameter("@Note", note);
|
||||
var DataOra = new SqlParameter("@DataOra", dataOra);
|
||||
|
||||
var result = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC stp_RC_insert @IdxMacchina, @MatrOpr, @EsitoOk, @Note, @DataOra", IdxMacc, MatrOpr, EsitoOk, Note, DataOra);
|
||||
fatto = result != 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua ricalcolo MSE x macchina indicata
|
||||
/// </summary>
|
||||
|
||||
@@ -20,14 +20,14 @@ namespace MP.Data.DatabaseModels
|
||||
public int? IdxPOdl { get; set; } = 0;
|
||||
public string CodArticolo { get; set; }
|
||||
public string Disegno { get; set; }
|
||||
public int? NumPezzi { get; set; }
|
||||
public int NumPezzi { get; set; } = 0;
|
||||
public decimal? TCAssegnato { get; set; }
|
||||
public DateTime? DataInizioOdl { get; set; }
|
||||
public string Semaforo { get; set; }
|
||||
public int? IdxStato { get; set; }
|
||||
public string DescrizioneStato { get; set; }
|
||||
public double? Durata { get; set; }
|
||||
public int? PezziProd { get; set; }
|
||||
public int PezziProd { get; set; } = 0;
|
||||
public int? PezziConf { get; set; }
|
||||
public decimal? TempoOn { get; set; }
|
||||
public decimal? TempoAuto { get; set; }
|
||||
@@ -138,5 +138,13 @@ namespace MP.Data.DatabaseModels
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public bool ReqFulfill
|
||||
{
|
||||
get
|
||||
{
|
||||
return PezziProd >= NumPezzi;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
#nullable disable
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("RegistroControlli")]
|
||||
public partial class RegistroControlliModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int IdxControllo { get; set; } = 0;
|
||||
public DateTime DataOra { get; set; }
|
||||
public string IdxMacchina { get; set; }
|
||||
public int IdxOdl { get; set; }
|
||||
public string CodArticolo { get; set; }
|
||||
public int MatrOpr { get; set; }
|
||||
public bool EsitoOk { get; set; }
|
||||
public string Note { get; set; }
|
||||
public string Operatore { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,8 @@ namespace MP.Data
|
||||
public virtual DbSet<StatoMacchineModel> DbSetStatoMacc { get; set; }
|
||||
public virtual DbSet<StatoProdModel> DbSetStatoProd { get; set; }
|
||||
public virtual DbSet<TurniMaccModel> DbSetTurniMacc { get; set; }
|
||||
public virtual DbSet<RegistroControlliModel> DbSetRegControlli { get; set; }
|
||||
|
||||
|
||||
public virtual DbSet<ST_Act> DbSetStAct { get; set; }
|
||||
public virtual DbSet<ST_ActRow> DbSetStActRow { get; set; }
|
||||
|
||||
@@ -631,6 +631,61 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco RC filtrato
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="idxODL"></param>
|
||||
/// <param name="dataFrom"></param>
|
||||
/// <param name="dataTo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<RegistroControlliModel>> RegControlliFilt(string idxMacchina, int idxODL, DateTime dataFrom, DateTime dataTo, bool showMulti)
|
||||
{
|
||||
// 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}:{idxODL}:{dataFrom:yyyyyMMdd-HHmm}:{dataFrom:yyyyyMMdd-HHmm}:{showMulti}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<RegistroControlliModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.RegControlliFilt(idxMacchina, idxODL, dataFrom, dataTo, showMulti);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<RegistroControlliModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"RegControlliFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra controllo
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="matrOpr"></param>
|
||||
/// <param name="esitoOk"></param>
|
||||
/// <param name="note"></param>
|
||||
/// <param name="dataOra"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RegControlliInsert(string idxMacchina, int matrOpr, bool esitoOk, string note, DateTime dataOra)
|
||||
{
|
||||
bool answ = dbTabController.RegControlliInsert(idxMacchina, matrOpr, esitoOk, note, dataOra);
|
||||
await FlushCache("RecContr");
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resetta (rileggendo) i dati della macchina
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user