cbd4a90d01
- Correzione MSE i MSEModel x naming - fix e test vari su app CORE (IOC/SPEC/TAB3/MON)
164 lines
4.0 KiB
C#
164 lines
4.0 KiB
C#
using global::Microsoft.AspNetCore.Components;
|
|
using MP.Data;
|
|
using MP.Data.DbModels;
|
|
using MP.Data.Services;
|
|
|
|
namespace MP_TAB3.Components
|
|
{
|
|
public partial class CommentEditor
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public bool CanSave { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public EventCallback<string> E_CommRec { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<DateTime> E_DateSel { get; set; }
|
|
|
|
[Parameter]
|
|
public MappaStatoExplModel? RecMSE { get; set; } = null;
|
|
|
|
[Parameter]
|
|
public string Title { get; set; } = "NA";
|
|
[Parameter]
|
|
public EventListModel? CurrComm
|
|
{
|
|
//get;
|
|
set
|
|
{
|
|
if (value != null)
|
|
{
|
|
DateSel = value.InizioStato ?? DateTime.Now;
|
|
UserComment = value.Value;
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
protected DateTime DateSel
|
|
{
|
|
get => dateSel.Round(TimeSpan.FromSeconds(1));
|
|
set
|
|
{
|
|
if (dateSel != value)
|
|
{
|
|
// arrotondo al secondo...
|
|
dateSel = value.AddMilliseconds(-value.Millisecond);
|
|
E_DateSel.InvokeAsync(value).ConfigureAwait(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Inject]
|
|
protected MessageService MServ { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected SharedMemService SMServ { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected TabDataService TabServ { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected void doCancel()
|
|
{
|
|
DoReset();
|
|
ToggleCtrl();
|
|
}
|
|
|
|
protected async Task doSave()
|
|
{
|
|
// registro evento
|
|
EventListModel newRec = new EventListModel()
|
|
{
|
|
IdxMacchina = IdxMacc,
|
|
InizioStato = DateSel,
|
|
IdxTipo = idxTipoCommento,
|
|
CodArticolo = CodArt,
|
|
Value = UserComment,
|
|
MatrOpr = MatrOpr,
|
|
pallet = "-"
|
|
};
|
|
// elimino vecchio se c'�...
|
|
await TabServ.EvListDelete(IdxMacc, DateSel, idxTipoCommento);
|
|
// inserisco
|
|
await TabServ.EvListInsert(newRec, MP.Core.Objects.Enums.tipoInputEvento.barcode);
|
|
// reset
|
|
DoReset();
|
|
ToggleCtrl();
|
|
}
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
idxTipoCommento = SMServ.GetConfInt("idxTipoCommento");
|
|
}
|
|
|
|
protected void ToggleCtrl()
|
|
{
|
|
ShowBtn = !ShowBtn;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private int idxTipoCommento = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#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 MatrOpr
|
|
{
|
|
get => MServ.MatrOpr;
|
|
}
|
|
|
|
private bool ShowBtn { get; set; } = true;
|
|
private string userComment { get; set; } = "";
|
|
|
|
private string UserComment
|
|
{
|
|
get => userComment.Trim();
|
|
set
|
|
{
|
|
if (userComment != value)
|
|
{
|
|
userComment = value;
|
|
E_CommRec.InvokeAsync(value).ConfigureAwait(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void DoReset()
|
|
{
|
|
UserComment = "";
|
|
DateSel = DateTime.Now;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |