diff --git a/MP-TAB-SERV/Components/ControlsMan.razor.cs b/MP-TAB-SERV/Components/ControlsMan.razor.cs
index 26c38499..027553c8 100644
--- a/MP-TAB-SERV/Components/ControlsMan.razor.cs
+++ b/MP-TAB-SERV/Components/ControlsMan.razor.cs
@@ -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();
}
}
diff --git a/MP-TAB-SERV/Components/DeclarEditor.razor b/MP-TAB-SERV/Components/DeclarEditor.razor
new file mode 100644
index 00000000..3f814bf9
--- /dev/null
+++ b/MP-TAB-SERV/Components/DeclarEditor.razor
@@ -0,0 +1,47 @@
+
+
+ @if (ShowDetail)
+ {
+
+
+
+
+ Tipologia
+
+
+
+
+
+
+
+
+
+
+ }
+
\ No newline at end of file
diff --git a/MP-TAB-SERV/Components/DeclarEditor.razor.cs b/MP-TAB-SERV/Components/DeclarEditor.razor.cs
new file mode 100644
index 00000000..f82e9834
--- /dev/null
+++ b/MP-TAB-SERV/Components/DeclarEditor.razor.cs
@@ -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 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 ListComplete { get; set; } = new List();
+
+ [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
+ }
+}
\ No newline at end of file
diff --git a/MP-TAB-SERV/Components/DeclarMan.razor b/MP-TAB-SERV/Components/DeclarMan.razor
index d4d18b69..5cad99e6 100644
--- a/MP-TAB-SERV/Components/DeclarMan.razor
+++ b/MP-TAB-SERV/Components/DeclarMan.razor
@@ -1,6 +1,76 @@
-DeclarList
+
+
+
-@code {
-
+@if (useOdl)
+{
+
}
+else
+{
+
+}
+
+
+
+
+
+
+
+
+
+
+ |
+ Tag |
+ Data |
+ Oper |
+ Macchina |
+ Dichiarazione |
+
+
+
+ @foreach (var item in ListPaged)
+ {
+
+ |
+
+ |
+
+
+ |
+
+ @item.DtRec
+ |
+
+ @item.CognNome
+ |
+
+ @item.IdxMacchina
+ |
+
+ @item.ValString
+ |
+
+ }
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MP-TAB-SERV/Components/DeclarMan.razor.cs b/MP-TAB-SERV/Components/DeclarMan.razor.cs
new file mode 100644
index 00000000..1d71c8d7
--- /dev/null
+++ b/MP-TAB-SERV/Components/DeclarMan.razor.cs
@@ -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
+
+ ///
+ /// Aggiorno valori produzione alla data richiesta...
+ ///
+ ///
+ 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 ListComplete { get; set; } = new List();
+ protected List ListPaged { get; set; } = new List();
+
+ [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
+ }
+}
\ No newline at end of file
diff --git a/MP-TAB-SERV/Components/ScrapEditor.razor.cs b/MP-TAB-SERV/Components/ScrapEditor.razor.cs
index 87339eb4..14d2d7e7 100644
--- a/MP-TAB-SERV/Components/ScrapEditor.razor.cs
+++ b/MP-TAB-SERV/Components/ScrapEditor.razor.cs
@@ -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);
diff --git a/MP-TAB-SERV/Components/ScrapMan.razor.cs b/MP-TAB-SERV/Components/ScrapMan.razor.cs
index a9c8c9f6..dc8c5248 100644
--- a/MP-TAB-SERV/Components/ScrapMan.razor.cs
+++ b/MP-TAB-SERV/Components/ScrapMan.razor.cs
@@ -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();
}
}
diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj
index b5d122d0..ab309546 100644
--- a/MP-TAB-SERV/MP-TAB-SERV.csproj
+++ b/MP-TAB-SERV/MP-TAB-SERV.csproj
@@ -3,7 +3,7 @@
net6.0
enable
- 6.16.2310.1616
+ 6.16.2310.1618
enable
MP_TAB_SERV
diff --git a/MP-TAB-SERV/Pages/Declarations.razor b/MP-TAB-SERV/Pages/Declarations.razor
index bf2b95b7..c9fb0ddd 100644
--- a/MP-TAB-SERV/Pages/Declarations.razor
+++ b/MP-TAB-SERV/Pages/Declarations.razor
@@ -7,5 +7,5 @@
else
{
-
+
}
diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html
index 8dbeecb3..dcd6c500 100644
--- a/MP-TAB-SERV/Resources/ChangeLog.html
+++ b/MP-TAB-SERV/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 6.16.2310.1616
+ Versione: 6.16.2310.1618
Note di rilascio:
-
diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt
index 82d7e6ce..c876022e 100644
--- a/MP-TAB-SERV/Resources/VersNum.txt
+++ b/MP-TAB-SERV/Resources/VersNum.txt
@@ -1 +1 @@
-6.16.2310.1616
+6.16.2310.1618
diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml
index 87dba021..4ebe2f54 100644
--- a/MP-TAB-SERV/Resources/manifest.xml
+++ b/MP-TAB-SERV/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 6.16.2310.1616
+ 6.16.2310.1618
https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip
https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html
false
diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs
index c5ac908c..5d7f5d5a 100644
--- a/MP.Data/Controllers/MpTabController.cs
+++ b/MP.Data/Controllers/MpTabController.cs
@@ -154,6 +154,25 @@ namespace MP.Data.Controllers
return dbResult;
}
+ ///
+ /// Restituisce l'anagrafica EVENTI per intero
+ ///
+ ///
+ public List AnagTagsOrd()
+ {
+ List dbResult = new List();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ dbResult = dbCtx
+ .DbSetAnagTags
+ .FromSqlRaw("exec dbo.stp_AT_getOrd")
+ .AsNoTracking()
+ .AsEnumerable()
+ .ToList();
+ }
+ return dbResult;
+ }
+
///
/// Verifica se sia necessario inserire un cambio di stato impianto in modalità batch
///
@@ -755,31 +774,6 @@ namespace MP.Data.Controllers
return fatto;
}
- ///
- /// Aggiunta record RegistroScarti
- ///
- ///
- ///
- public async Task 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;
- }
///
/// Aggiunta record RegistroScarti
///
@@ -809,6 +803,86 @@ namespace MP.Data.Controllers
return dbResult;
}
+ ///
+ /// Aggiunta record RegistroScarti
+ ///
+ ///
+ ///
+ public async Task 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;
+ }
+
+ ///
+ /// Aggiunta record Registro Dichiarazioni
+ ///
+ ///
+ ///
+ public async Task 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;
+ }
+
+ ///
+ /// Aggiunta record RegistroScarti
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public List RegDichiarGetFilt(string idxMacchina, string tagCode, int matrOpr, int idxODL, DateTime dataFrom, DateTime dataTo)
+ {
+ List dbResult = new List();
+ 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;
+ }
///
/// Effettua ricalcolo MSE x macchina indicata
///
diff --git a/MP.Data/DatabaseModels/AnagTagsModel.cs b/MP.Data/DatabaseModels/AnagTagsModel.cs
new file mode 100644
index 00000000..46acfdc5
--- /dev/null
+++ b/MP.Data/DatabaseModels/AnagTagsModel.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+#nullable disable
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+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
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/DatabaseModels/RegistroDichiarazioniModel.cs b/MP.Data/DatabaseModels/RegistroDichiarazioniModel.cs
new file mode 100644
index 00000000..3d3e800c
--- /dev/null
+++ b/MP.Data/DatabaseModels/RegistroDichiarazioniModel.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+#nullable disable
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+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
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs
index d3fccf85..403a09ab 100644
--- a/MP.Data/MoonProContext.cs
+++ b/MP.Data/MoonProContext.cs
@@ -43,6 +43,7 @@ namespace MP.Data
public virtual DbSet DbSetArticoli { get; set; }
public virtual DbSet DbSetAnagEventi { get; set; }
public virtual DbSet DbSetAnagStati { get; set; }
+ public virtual DbSet DbSetAnagTags { get; set; }
public virtual DbSet DbSetMacchine { get; set; }
public virtual DbSet DbSetMSE { get; set; }
public virtual DbSet DbSetConfig { get; set; }
@@ -75,6 +76,7 @@ namespace MP.Data
public virtual DbSet DbSetTurniMacc { get; set; }
public virtual DbSet DbSetRegControlli { get; set; }
public virtual DbSet DbSetRegScarti { get; set; }
+ public virtual DbSet DbSetRegDich { get; set; }
public virtual DbSet DbSetStAct { get; set; }
@@ -560,6 +562,10 @@ namespace MP.Data
{
entity.ToView("v_selCauScarto");
});
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToView("v_DD_exp");
+ });
OnModelCreatingPartial(modelBuilder);
diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs
index 556db2a9..202f3243 100644
--- a/MP.Data/Services/TabDataService.cs
+++ b/MP.Data/Services/TabDataService.cs
@@ -204,6 +204,41 @@ namespace MP.Data.Services
return result;
}
+ ///
+ /// Restituisce l'anagrafica EVENTI per intero
+ ///
+ ///
+ public async Task
> AnagTagsOrd()
+ {
+ // setup parametri costanti
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ List? result = new List();
+ // cerco in redis...
+ string currKey = $"{redisBaseKey}:AnagTags";
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ if (rawData.HasValue)
+ {
+ result = JsonConvert.DeserializeObject>($"{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();
+ }
+ sw.Stop();
+ Log.Debug($"AnagTagsOrd | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
+
///
/// Elenco completo STATI
///
@@ -670,6 +705,95 @@ namespace MP.Data.Services
return result;
}
+ ///
+ /// Registra controllo
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task 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;
+ }
+
+ ///
+ /// Aggiunta record RegistroScarti
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task> 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? result = new List();
+ // 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>($"{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();
+ }
+ sw.Stop();
+ Log.Debug($"RegDichiarGetFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
+
+ ///
+ /// Aggiunta record Registro Dichiarazioni
+ ///
+ ///
+ ///
+ public async Task 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;
+ }
+
///
/// Restituisce elenco RS filtrato
///
@@ -687,7 +811,7 @@ namespace MP.Data.Services
sw.Start();
List? result = new List();
// 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;
}
- ///
- /// Registra controllo
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public async Task 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;
- }
-
///
/// Aggiunta record RegistroScarti
///