Dichiarazioni: ok inserimento + display (manca edit)
This commit is contained in:
@@ -64,7 +64,9 @@ namespace MP_TAB_SERV.Components
|
||||
if (RecMSE != null)
|
||||
{
|
||||
IdxMaccSel = RecMSE.IdxMacchina;
|
||||
CurrPeriodo = new Periodo(PeriodSet.ThisWeek);
|
||||
DateTime fine = DateTime.Today.AddDays(1);
|
||||
DateTime inizio = fine.AddDays(-8);
|
||||
CurrPeriodo = new Periodo(inizio, fine);
|
||||
await doUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<div class="card">
|
||||
<div class="card-header p-0">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<button class="btn btn-lg bg-info w-100" @onclick="ToggleCtrl">
|
||||
<i class="fa-solid fa-comments"></i>
|
||||
|
||||
<span class="fs-4 fw-bold">@Title</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (ShowDetail)
|
||||
{
|
||||
<div class="card-body p-1">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fa-solid fa-tag"></i> Tipologia</span>
|
||||
<select @bind="@TagCodeSel" class="form-select">
|
||||
@foreach (var item in ListComplete)
|
||||
{
|
||||
<option value="@item.TagCode">@item.TagDescr</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Data Ora</span>
|
||||
<input type="datetime-local" class="form-control text-end" @bind="@DateSel">
|
||||
<button class="btn btn-secondary" @onclick="resetDate"><i class="fa-solid fa-arrow-rotate-right"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 my-1">
|
||||
<div class="form-floating">
|
||||
<textarea type="text" class="form-control" id="floatingComm" @bind="@UserComment"></textarea>
|
||||
<label for="floatingComm">Dichiarazione</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<button class="btn btn-success w-100" @onclick="DoSave"><i class="fa-solid fa-floppy-disk"></i> Salva</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,173 @@
|
||||
using global::Microsoft.AspNetCore.Components;
|
||||
using MP.Data;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.Services;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class DeclarEditor
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> E_Updated { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public MappaStatoExpl? RecMSE { get; set; } = null;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected DateTime DateSel
|
||||
{
|
||||
get => dateSel.Round(TimeSpan.FromSeconds(1));
|
||||
set
|
||||
{
|
||||
if (dateSel != value)
|
||||
{
|
||||
dateSel = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected List<AnagTagsModel> ListComplete { get; set; } = new List<AnagTagsModel>();
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TabServ { get; set; } = null!;
|
||||
|
||||
protected string TagCodeSel
|
||||
{
|
||||
get => tagCode;
|
||||
set
|
||||
{
|
||||
if (tagCode != value)
|
||||
{
|
||||
tagCode = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string Title
|
||||
{
|
||||
get => ShowDetail ? "Nascondi Inserimento Dichiarazione" : "Mostra Inserimento Dichiarazione";
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void doCancel()
|
||||
{
|
||||
DoReset();
|
||||
}
|
||||
|
||||
protected async Task DoSave()
|
||||
{
|
||||
// registro scarto
|
||||
RegistroDichiarazioniModel newRec = new RegistroDichiarazioniModel()
|
||||
{
|
||||
IdxMacchina = IdxMacc,
|
||||
DtRec = DateSel,
|
||||
TagCode = TagCodeSel,
|
||||
MatrOpr = MatrOpr,
|
||||
ValString = UserComment
|
||||
};
|
||||
// inserisco
|
||||
await TabServ.RegDichiarInsert(newRec);
|
||||
|
||||
// reset
|
||||
DoReset();
|
||||
//ToggleCtrl();
|
||||
await E_Updated.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
ListComplete = await TabServ.AnagTagsOrd();
|
||||
}
|
||||
|
||||
protected void resetDate()
|
||||
{
|
||||
DateSel = DateTime.Now;
|
||||
}
|
||||
|
||||
protected void ToggleCtrl()
|
||||
{
|
||||
ShowDetail = !ShowDetail;
|
||||
if (ShowDetail)
|
||||
{
|
||||
DateSel = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string CodArt
|
||||
{
|
||||
get => RecMSE != null ? RecMSE.CodArticolo : "";
|
||||
}
|
||||
|
||||
private DateTime dateSel { get; set; } = DateTime.Now;
|
||||
|
||||
private string IdxMacc
|
||||
{
|
||||
get => RecMSE != null ? RecMSE.IdxMacchina : "";
|
||||
}
|
||||
|
||||
private int idxOdl { get; set; } = 0;
|
||||
|
||||
private int IdxOdl
|
||||
{
|
||||
get => idxOdl;
|
||||
set => idxOdl = value;
|
||||
}
|
||||
|
||||
private int MatrOpr
|
||||
{
|
||||
get => MServ.MatrOpr;
|
||||
}
|
||||
|
||||
private bool ShowDetail { get; set; } = true;
|
||||
private string tagCode { get; set; } = "";
|
||||
private string userComment { get; set; } = "";
|
||||
|
||||
private string UserComment
|
||||
{
|
||||
get => userComment.Trim();
|
||||
set
|
||||
{
|
||||
if (userComment != value)
|
||||
{
|
||||
userComment = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void DoReset()
|
||||
{
|
||||
UserComment = "";
|
||||
DateSel = DateTime.Now;
|
||||
ShowDetail = true;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,76 @@
|
||||
<h3>DeclarList</h3>
|
||||
|
||||
|
||||
<MachSel RecMSE="RecMSE" E_MachSel="SetMacc"></MachSel>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<h2>Tipo Selezione</h2>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="form-check form-switch fs-3">
|
||||
<input class="form-check-input" type="checkbox" @bind="@useOdl">
|
||||
<label class="form-check-label">@selMessage</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
@if (useOdl)
|
||||
{
|
||||
<MachineSelOdl IdxMacchina="@IdxMaccSel" E_OdlSel="SetOdl"></MachineSelOdl>
|
||||
}
|
||||
else
|
||||
{
|
||||
<EgwCoreLib.Razor.PeriodoSel CurrPeriodo="CurrPeriodo" E_PeriodoSel="SetPeriodo"></EgwCoreLib.Razor.PeriodoSel>
|
||||
}
|
||||
<ShowProcessing Message="Caricamento" IsProcessing="@isProcessing"></ShowProcessing>
|
||||
<div class="card">
|
||||
<div class="card-header bg-dark">
|
||||
<DeclarEditor RecMSE="@RecMSE" E_Updated="doUpdate"></DeclarEditor>
|
||||
</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></th>
|
||||
<th>Tag</th>
|
||||
<th>Data</th>
|
||||
<th>Oper</th>
|
||||
<th>Macchina</th>
|
||||
<th class="text-end">Dichiarazione</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListPaged)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<button class="btn btn-primary"><i class="fa-solid fa-pen"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
<i class="@item.CssClass" aria-hidden="true"></i>
|
||||
</td>
|
||||
<td>
|
||||
@item.DtRec
|
||||
</td>
|
||||
<td>
|
||||
@item.CognNome
|
||||
</td>
|
||||
<td>
|
||||
@item.IdxMacchina
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@item.ValString
|
||||
</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,148 @@
|
||||
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 DeclarMan
|
||||
{
|
||||
#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.RegDichiarGetFilt(IdxMaccSel, "", 0, IdxOdl, CurrPeriodo.Inizio, CurrPeriodo.Fine);
|
||||
TotalCount = ListComplete.Count;
|
||||
// esegue paginazione
|
||||
UpdateTable();
|
||||
}
|
||||
isProcessing = false;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<RegistroDichiarazioniModel> ListComplete { get; set; } = new List<RegistroDichiarazioniModel>();
|
||||
protected List<RegistroDichiarazioniModel> ListPaged { get; set; } = new List<RegistroDichiarazioniModel>();
|
||||
|
||||
[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;
|
||||
DateTime fine = DateTime.Today.AddDays(1);
|
||||
DateTime inizio = fine.AddDays(-8);
|
||||
CurrPeriodo = new Periodo(inizio, fine);
|
||||
await doUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
NumRecPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void SavePage(int newNum)
|
||||
{
|
||||
PageNum = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected async Task SetMacc(string selIdxMacc)
|
||||
{
|
||||
isProcessing = true;
|
||||
await Task.Delay(1);
|
||||
IdxMaccSel = selIdxMacc;
|
||||
await doUpdate();
|
||||
isProcessing = false;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task SetOdl(int selIdxOdl)
|
||||
{
|
||||
isProcessing = true;
|
||||
await Task.Delay(1);
|
||||
IdxOdl = selIdxOdl;
|
||||
await doUpdate();
|
||||
isProcessing = false;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task SetPeriodo(Periodo newPeriodo)
|
||||
{
|
||||
CurrPeriodo = newPeriodo;
|
||||
await doUpdate();
|
||||
}
|
||||
|
||||
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 isProcessing = false;
|
||||
private int NumRecPage = 10;
|
||||
private int PageNum = 1;
|
||||
private int TotalCount = 0;
|
||||
private bool useOdl = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private Periodo CurrPeriodo { get; set; } = new Periodo();
|
||||
|
||||
private string IdxMaccSel { get; set; } = "";
|
||||
|
||||
private int IdxOdl { get; set; } = 0;
|
||||
|
||||
private string selMessage
|
||||
{
|
||||
get => useOdl ? "Periodo da ODL" : "Periodo Libero";
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -17,12 +17,6 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int dltMinRealtime = 1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected DateTime DateSel
|
||||
@@ -84,8 +78,7 @@ namespace MP_TAB_SERV.Components
|
||||
Causale = currCau.value,
|
||||
Qta = NumPz,
|
||||
MatrOpr = MatrOpr,
|
||||
Note=UserComment
|
||||
|
||||
Note = UserComment
|
||||
};
|
||||
// inserisco
|
||||
await TabServ.RegScartiInsert(newRec);
|
||||
|
||||
@@ -61,7 +61,9 @@ namespace MP_TAB_SERV.Components
|
||||
if (RecMSE != null)
|
||||
{
|
||||
IdxMaccSel = RecMSE.IdxMacchina;
|
||||
CurrPeriodo = new Periodo(PeriodSet.ThisWeek);
|
||||
DateTime fine = DateTime.Today.AddDays(1);
|
||||
DateTime inizio = fine.AddDays(-8);
|
||||
CurrPeriodo = new Periodo(inizio, fine);
|
||||
await doUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2310.1616</Version>
|
||||
<Version>6.16.2310.1618</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB_SERV</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
else
|
||||
{
|
||||
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
|
||||
<DeclarMan></DeclarMan>
|
||||
<DeclarMan RecMSE="CurrMSE"></DeclarMan>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2310.1616</h4>
|
||||
<h4>Versione: 6.16.2310.1618</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2310.1616
|
||||
6.16.2310.1618
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2310.1616</version>
|
||||
<version>6.16.2310.1618</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>
|
||||
|
||||
@@ -154,6 +154,25 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce l'anagrafica EVENTI per intero
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<AnagTagsModel> AnagTagsOrd()
|
||||
{
|
||||
List<AnagTagsModel> dbResult = new List<AnagTagsModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetAnagTags
|
||||
.FromSqlRaw("exec dbo.stp_AT_getOrd")
|
||||
.AsNoTracking()
|
||||
.AsEnumerable()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se sia necessario inserire un cambio di stato impianto in modalità batch
|
||||
/// </summary>
|
||||
@@ -755,31 +774,6 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RegScartiInsert(RegistroScartiModel newRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@idxMacchina", newRec.IdxMacchina);
|
||||
var DataOra = new SqlParameter("@DataOra", newRec.DataOra);
|
||||
var Causale = new SqlParameter("@Causale", newRec.Causale);
|
||||
var Qta = new SqlParameter("@Qta", newRec.Qta);
|
||||
var Note = new SqlParameter("@Note", newRec.Note);
|
||||
var MatrOpr = new SqlParameter("@MatrOpr", newRec.MatrOpr);
|
||||
|
||||
var result = await dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRawAsync("exec dbo.stp_RS_insert @idxMacchina, @DataOra, @Causale, @Qta, @Note, @MatrOpr", IdxMacchina, DataOra, Causale, Qta, Note, MatrOpr);
|
||||
// indico eseguito!
|
||||
fatto = result > 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
/// </summary>
|
||||
@@ -809,6 +803,86 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RegScartiInsert(RegistroScartiModel newRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@idxMacchina", newRec.IdxMacchina);
|
||||
var DataOra = new SqlParameter("@DataOra", newRec.DataOra);
|
||||
var Causale = new SqlParameter("@Causale", newRec.Causale);
|
||||
var Qta = new SqlParameter("@Qta", newRec.Qta);
|
||||
var Note = new SqlParameter("@Note", newRec.Note);
|
||||
var MatrOpr = new SqlParameter("@MatrOpr", newRec.MatrOpr);
|
||||
|
||||
var result = await dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRawAsync("exec dbo.stp_RS_insert @idxMacchina, @DataOra, @Causale, @Qta, @Note, @MatrOpr", IdxMacchina, DataOra, Causale, Qta, Note, MatrOpr);
|
||||
// indico eseguito!
|
||||
fatto = result > 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record Registro Dichiarazioni
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RegDichiarInsert(RegistroDichiarazioniModel newRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var TagCode = new SqlParameter("@TagCode", newRec.TagCode);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", newRec.IdxMacchina);
|
||||
var DtRec = new SqlParameter("@DtRec", newRec.DtRec);
|
||||
var MatrOpr = new SqlParameter("@MatrOpr", newRec.MatrOpr);
|
||||
var ValString = new SqlParameter("@ValString", newRec.ValString);
|
||||
|
||||
var result = await dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRawAsync("exec dbo.stp_DD_insertQuery @TagCode, @IdxMacchina, @DtRec, @MatrOpr, @ValString", TagCode, IdxMacchina, DtRec, MatrOpr, ValString);
|
||||
// indico eseguito!
|
||||
fatto = result > 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="tagCode"></param>
|
||||
/// <param name="matrOpr"></param>
|
||||
/// <param name="dataFrom"></param>
|
||||
/// <param name="dataTo"></param>
|
||||
/// <returns></returns>
|
||||
public List<RegistroDichiarazioniModel> RegDichiarGetFilt(string idxMacchina, string tagCode, int matrOpr, int idxODL, DateTime dataFrom, DateTime dataTo)
|
||||
{
|
||||
List<RegistroDichiarazioniModel> dbResult = new List<RegistroDichiarazioniModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var TagCode = new SqlParameter("@TagCode", tagCode);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var MatrOpr = new SqlParameter("@MatrOpr", matrOpr);
|
||||
var IdxODL = new SqlParameter("@IdxODL", idxODL);
|
||||
var DtFrom = new SqlParameter("@DataFrom", dataFrom);
|
||||
var DtTo = new SqlParameter("@DataTo", dataTo);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetRegDich
|
||||
.FromSqlRaw("EXEC stp_DD_getFilt @TagCode, @IdxMacchina, @MatrOpr, @IdxODL, @DataFrom, @DataTo", TagCode, IdxMacchina, MatrOpr, IdxODL, DtFrom, DtTo)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua ricalcolo MSE x macchina indicata
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
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("AnagTags")]
|
||||
public partial class AnagTagsModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.None), MaxLength(50)]
|
||||
public string TagCode { get; set; } = "";
|
||||
|
||||
public string TagDescr { get; set; } = "";
|
||||
|
||||
public int DisplOrd { get; set; } = 0;
|
||||
|
||||
public string CssClass { get; set; } = "";
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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("DiarioDichiarazioni")]
|
||||
public partial class RegistroDichiarazioniModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int IdxDich { get; set; }
|
||||
|
||||
public DateTime DtRec { get; set; } = DateTime.Now;
|
||||
public string IdxMacchina { get; set; } = "";
|
||||
public string TagCode { get; set; } = "";
|
||||
public int MatrOpr { get; set; }
|
||||
public string ValString { get; set; } = "";
|
||||
public string CognNome { get; set; } = "";
|
||||
public string CssClass { get; set; } = "";
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,7 @@ namespace MP.Data
|
||||
public virtual DbSet<AnagArticoli> DbSetArticoli { get; set; }
|
||||
public virtual DbSet<AnagEventiModel> DbSetAnagEventi { get; set; }
|
||||
public virtual DbSet<AnagStatiModel> DbSetAnagStati { get; set; }
|
||||
public virtual DbSet<AnagTagsModel> DbSetAnagTags { get; set; }
|
||||
public virtual DbSet<Macchine> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<MappaStatoExpl> DbSetMSE { get; set; }
|
||||
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
|
||||
@@ -75,6 +76,7 @@ namespace MP.Data
|
||||
public virtual DbSet<TurniMaccModel> DbSetTurniMacc { get; set; }
|
||||
public virtual DbSet<RegistroControlliModel> DbSetRegControlli { get; set; }
|
||||
public virtual DbSet<RegistroScartiModel> DbSetRegScarti { get; set; }
|
||||
public virtual DbSet<RegistroDichiarazioniModel> DbSetRegDich { get; set; }
|
||||
|
||||
|
||||
public virtual DbSet<ST_Act> DbSetStAct { get; set; }
|
||||
@@ -560,6 +562,10 @@ namespace MP.Data
|
||||
{
|
||||
entity.ToView("v_selCauScarto");
|
||||
});
|
||||
modelBuilder.Entity<RegistroDichiarazioniModel>(entity =>
|
||||
{
|
||||
entity.ToView("v_DD_exp");
|
||||
});
|
||||
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
|
||||
@@ -204,6 +204,41 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce l'anagrafica EVENTI per intero
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AnagTagsModel>> AnagTagsOrd()
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<AnagTagsModel>? result = new List<AnagTagsModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:AnagTags";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<AnagTagsModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.AnagTagsOrd();
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<AnagTagsModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"AnagTagsOrd | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo STATI
|
||||
/// </summary>
|
||||
@@ -670,6 +705,95 @@ namespace MP.Data.Services
|
||||
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 = false;
|
||||
try
|
||||
{
|
||||
// inserisco evento
|
||||
answ = dbTabController.RegControlliInsert(idxMacchina, matrOpr, esitoOk, note, dataOra);
|
||||
await FlushCache("RecContr");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in RegControlliInsert | macchina: {idxMacchina} | DataOra: {dataOra} | MatrOpr: {matrOpr} | Qta {esitoOk} | Note: {note}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="tagCode"></param>
|
||||
/// <param name="matrOpr"></param>
|
||||
/// <param name="dataFrom"></param>
|
||||
/// <param name="dataTo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<RegistroDichiarazioniModel>> RegDichiarGetFilt(string idxMacchina, string tagCode, int matrOpr, int idxODL, DateTime dataFrom, DateTime dataTo)
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<RegistroDichiarazioniModel>? result = new List<RegistroDichiarazioniModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:RegDichiar:{idxMacchina}:{tagCode}:{matrOpr}:{idxODL}:{dataFrom:yyyyyMMdd-HHmm}:{dataTo:yyyyyMMdd-HHmm}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<RegistroDichiarazioniModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.RegDichiarGetFilt(idxMacchina, tagCode, matrOpr, idxODL, dataFrom, dataTo);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<RegistroDichiarazioniModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"RegDichiarGetFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record Registro Dichiarazioni
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RegDichiarInsert(RegistroDichiarazioniModel newRec)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// inserisco evento
|
||||
answ = await dbTabController.RegDichiarInsert(newRec);
|
||||
// reset cache eventi/commenti
|
||||
await FlushCache("RegDichiar");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in RegDichiarInsert | macchina: {newRec.IdxMacchina} | DtRec: {newRec.DtRec} | TagCode: {newRec.TagCode} | MatrOpr: {newRec.MatrOpr} | ValString {newRec.ValString}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco RS filtrato
|
||||
/// </summary>
|
||||
@@ -687,7 +811,7 @@ namespace MP.Data.Services
|
||||
sw.Start();
|
||||
List<RegistroScartiModel>? result = new List<RegistroScartiModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:RegScarti:{idxMacchina}:{idxODL}:{dataFrom:yyyyyMMdd-HHmm}:{dataFrom:yyyyyMMdd-HHmm}:{showMulti}";
|
||||
string currKey = $"{redisBaseKey}:RegScarti:{idxMacchina}:{idxODL}:{dataFrom:yyyyyMMdd-HHmm}:{dataTo:yyyyyMMdd-HHmm}:{showMulti}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
@@ -710,22 +834,6 @@ namespace MP.Data.Services
|
||||
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>
|
||||
/// Aggiunta record RegistroScarti
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user