Salvataggio da esterno componente x commenti

This commit is contained in:
Samuele Locatelli
2023-10-10 17:23:08 +02:00
parent a576695371
commit db105b8f9a
8 changed files with 72 additions and 60 deletions
+9 -16
View File
@@ -47,14 +47,12 @@ namespace MP_TAB_SERV.Components
[Parameter]
public EventListModel? CurrRecord
{
//get;
set
{
if (value != null)
{
DateSel = value.InizioStato ?? DateTime.Now;
UserComment = value.Value;
//ShowBtn = insRealtime;
ShowBtn = false;
}
}
@@ -90,12 +88,12 @@ namespace MP_TAB_SERV.Components
#region Protected Methods
protected void doCancel()
public void doCancel()
{
DoReset();
}
protected async Task doSave()
public async Task doSave()
{
// registro evento
EventListModel newRec = new EventListModel()
@@ -126,21 +124,16 @@ namespace MP_TAB_SERV.Components
protected override async Task OnAfterRenderAsync(bool firstRender)
{
#if false
// cerco se ci sia una data-ora rif salvata...
DateSel = await MServ.CommentoDtRifGet(false);
if (!insRealtime)
// verifico SE ci sia una data da usare...
bool hasDtRif = await MServ.SessHasVal(MessageService.KeyCommDtRif);
if (hasDtRif)
{
await Task.Delay(1);
ShowBtn = false;
UserComment = await MServ.CommentoValGet(true);
if (ShowBtn)
{
DateSel = await MServ.CommentoDtRifGet(true);
ShowBtn = false;
await InvokeAsync(StateHasChanged);
}
}
#endif
DateSel = await MServ.CommentoDtRifGet(true);
await InvokeAsync(StateHasChanged);
}
}
+6 -6
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>6.16.2310.1011</Version>
<Version>6.16.2310.1016</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB_SERV</RootNamespace>
</PropertyGroup>
@@ -47,10 +47,10 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
</Target>
</Project>
+1 -1
View File
@@ -10,7 +10,7 @@ else
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<NotesEditor Title="Dichiarazione Fermo Retroattiva + Commento" RecMSE="CurrMSE"></NotesEditor>
<NotesEditor @ref="noteEdit" Title="Dichiarazione Fermo Retroattiva + Commento" RecMSE="CurrMSE" CanSave="false" E_DateSel="SetDate"></NotesEditor>
<div class="d-flex justify-content-between flex-wrap align-items-center mb-3">
@if (!string.IsNullOrEmpty(lblOut))
+39 -27
View File
@@ -2,36 +2,17 @@ using global::Microsoft.AspNetCore.Components;
using MP.Data;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using MP_TAB_SERV.Components;
namespace MP_TAB_SERV.Pages
{
public partial class ProdStop
{
#region Public Properties
#region Protected Fields
/// <summary>
/// Determina se insert sia Realtime o batch con DataOra (in base a diff tra DataOra
/// selezionata e realtime, se superiore ad X minuti NON realtime)
/// </summary>
public bool insRealtime
{
get
{
bool answ = true;
//try
//{
// if (Math.Abs(DtRif.Subtract(DateTime.Now).TotalMinutes) > dltMinRealtime)
// {
// answ = false;
// }
//}
//catch
//{ }
return answ;
}
}
protected int dltMinRealtime = 1;
#endregion Public Properties
#endregion Protected Fields
#region Protected Properties
@@ -39,10 +20,29 @@ namespace MP_TAB_SERV.Pages
protected MappaStatoExpl? CurrMSE { get; set; } = null;
protected DateTime DtRif { get; set; } = DateTime.Now;
protected List<vSelEventiBCodeModel> events2show { get; set; } = new List<vSelEventiBCodeModel>();
protected string IdxMacc { get; set; } = "";
/// <summary>
/// Determina se insert sia Realtime o batch con DataOra (in base a diff tra DataOra
/// selezionata e realtime, se superiore ad X minuti NON realtime)
/// </summary>
protected bool insRealtime
{
get
{
bool answ = true;
if (Math.Abs(DtRif.Subtract(DateTime.Now).TotalMinutes) > dltMinRealtime)
{
answ = false;
}
return answ;
}
}
protected string lblOut { get; set; } = "";
[Inject]
@@ -51,13 +51,17 @@ namespace MP_TAB_SERV.Pages
[Inject]
protected MessageService MServ { get; set; } = null!;
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
protected NotesEditor? noteEdit { get; set; }
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
[Inject]
protected TabDataService TabServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
@@ -99,6 +103,12 @@ namespace MP_TAB_SERV.Pages
}
else
{
// chiamo registrazione commento...
if (noteEdit != null)
{
await noteEdit.doSave();
}
#if false
// in primis disabilito insert...
DataLayerObj.taStatoMacchine.setInsEnabled(idxMacchina, false);
@@ -187,12 +197,16 @@ namespace MP_TAB_SERV.Pages
protected override async Task OnInitializedAsync()
{
dltMinRealtime = SMServ.GetConfInt("dltMinRealtime");
// leggo gli altri dati
await ReloadData();
}
protected void SetDate(DateTime newDate)
{
DtRif = newDate;
}
#endregion Protected Methods
#region Private Properties
@@ -203,8 +217,6 @@ namespace MP_TAB_SERV.Pages
}
#endregion Private Properties
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
#region Private Methods
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2310.1011</h4>
<h4>Versione: 6.16.2310.1016</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2310.1011
6.16.2310.1016
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2310.1011</version>
<version>6.16.2310.1016</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>
+14 -7
View File
@@ -153,17 +153,12 @@ namespace MP.Data.Services
bool hasKey = await sessionStore.ContainKeyAsync(KeyCommDtRif);
if (hasKey)
{
//try
//{
// recupero
answ = await sessionStore.GetItemAsync<DateTime>(KeyCommDtRif);
// svuoto data registrata se richiesto
if (remAfter)
{
await sessionStore.RemoveItemAsync(KeyCommDtRif);
}
//}
//catch { }
}
return answ;
}
@@ -176,6 +171,18 @@ namespace MP.Data.Services
await sessionStore.SetItemAsync(KeyCommDtRif, DtRif);
}
/// <summary>
/// Verifico esistenza chiave in session store
/// </summary>
/// <param name="keyName"></param>
/// <returns></returns>
public async Task<bool> SessHasVal(string keyName)
{
bool hasKey = await sessionStore.ContainKeyAsync(keyName);
return hasKey;
}
/// <summary>
/// Commento fermata x recupero in editing
/// </summary>
@@ -342,8 +349,8 @@ namespace MP.Data.Services
#region Private Fields
private const string KeyCommDtRif = "DtRifComm";
private const string KeyCommText = "ValComm";
public const string KeyCommDtRif = "DtRifComm";
public const string KeyCommText = "ValComm";
#if false
public bool IsActive
{