modifica gest licenza LAND

This commit is contained in:
Samuele Locatelli
2023-10-16 15:03:47 +02:00
parent b2c9fac4ca
commit 283cb70251
13 changed files with 642 additions and 63 deletions
@@ -167,15 +167,23 @@ namespace MP_TAB_SERV.Components
private bool showInsert = false;
private bool showNote = false;
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
}
}
+27 -32
View File
@@ -36,9 +36,26 @@ namespace MP_TAB_SERV.Components
}
}
}
private int idxOdlSel { get; set; } = 0;
protected List<vSelOdlModel> ListODL { get; set; } = new();
protected int NumRec
{
get => numRec;
set
{
if (numRec != value)
{
numRec = value;
var pUpd = Task.Run(async () =>
{
await ReloadData();
});
pUpd.Wait();
}
}
}
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
@@ -51,36 +68,7 @@ namespace MP_TAB_SERV.Components
await ReloadData();
}
#endregion Protected Methods
#region Private Properties
private int numRec { get; set; } = 10;
private int NumRec
{
get => numRec;
set
{
if (numRec != value)
{
numRec = value;
var pUpd = Task.Run(async () =>
{
await ReloadData();
await Task.Delay(1);
//await InvokeAsync(() => StateHasChanged());
});
pUpd.Wait();
}
}
}
#endregion Private Properties
#region Private Methods
private async Task ReloadData()
protected async Task ReloadData()
{
isProcessing = true;
await Task.Delay(1);
@@ -92,6 +80,13 @@ namespace MP_TAB_SERV.Components
await Task.Delay(1);
}
#endregion Private Methods
#endregion Protected Methods
#region Private Properties
private int idxOdlSel { get; set; } = 0;
private int numRec { get; set; } = 10;
#endregion Private Properties
}
}
+41
View File
@@ -0,0 +1,41 @@
<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-bug"></i>
&nbsp;
<span class="fs-4 fw-bold">@Title</span>
</button>
</div>
</div>
</div>
@if (ShowDetail)
{
<div class="card-body p-1 bg-dark text-light">
<div class="row">
<div class="col-6">
<div class="input-group">
<span class="input-group-text" id="basic-addon1">Data Ora</span>
<input type="datetime-local" class="form-control" id="floatDate" @bind="@DateSel">
</div>
</div>
<div class="col-6">
<button class="btn btn-warning w-100 align-middle" @onclick="doCancel"><i class="fa-solid fa-ban"></i> Annulla</button>
</div>
<div class="col-12 my-1">
<div class="form-floating">
<textarea type="text" class="form-control" id="floatingComm" style="height: 6rem;" @bind="@UserComment"></textarea>
<label for="floatingComm">Commento</label>
</div>
</div>
<div class="col-12">
@if (CanSave)
{
<button class="btn btn-success w-100" @onclick="doSave"><i class="fa-solid fa-plus"></i> Salva</button>
}
</div>
</div>
</div>
}
</div>
+242
View File
@@ -0,0 +1,242 @@
using global::System;
using global::System.Collections.Generic;
using global::System.Linq;
using global::System.Threading.Tasks;
using global::Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP_TAB_SERV;
using MP_TAB_SERV.Shared;
using MP_TAB_SERV.Components;
using MP.Data;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
using MP.Data.Services;
using Newtonsoft.Json;
using NLog;
namespace MP_TAB_SERV.Components
{
public partial class ScrapEditor
{
#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 EventCallback<bool> E_Updated { get; set; }
[Parameter]
public MappaStatoExpl? RecMSE { get; set; } = null;
protected string Title
{
get => ShowDetail? "Nascondi Registrazione Scarti": "Mostra Registrazione Scarti";
}
[Parameter]
public EventListModel? CurrRecord
{
set
{
if (value != null)
{
DateSel = value.InizioStato ?? DateTime.Now;
UserComment = value.Value;
ShowDetail = false;
}
}
}
#endregion Public Properties
#region Protected Properties
protected DateTime DateSel
{
get => dateSel.Round(TimeSpan.FromSeconds(1));
set
{
if (dateSel != value)
{
dateSel = value;
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();
}
/// <summary>
/// Forza salvataggio impostando data-ora
/// </summary>
/// <param name="dtRif"></param>
/// <returns></returns>
public async Task ForceSave(DateTime dtRif)
{
DateSel = dtRif;
// ora salvo
await doSave();
}
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.Data.Objects.Enums.tipoInputEvento.commento);
// reset
DoReset();
//ToggleCtrl();
await E_Updated.InvokeAsync(true);
}
protected override void OnInitialized()
{
idxTipoCommento = SMServ.GetConfInt("idxTipoCommento");
dltMinRealtime = SMServ.GetConfInt("dltMinRealtime");
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
// verifico SE ci sia una data da usare...
bool hasDtRif = await MServ.SessHasVal(MessageService.KeyCommDtRif);
if (hasDtRif)
{
await Task.Delay(1);
ShowDetail = false;
UserComment = await MServ.CommentoValGet(true);
DateSel = await MServ.CommentoDtRifGet(true);
await InvokeAsync(StateHasChanged);
}
}
protected int dltMinRealtime = 1;
/// <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;
try
{
if (Math.Abs(DateSel.Subtract(DateTime.Now).TotalMinutes) > dltMinRealtime)
{
answ = false;
}
}
catch
{ }
return answ;
}
}
protected void ToggleCtrl()
{
ShowDetail = !ShowDetail;
if (ShowDetail)
{
DateSel = DateTime.Now;
}
}
#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 ShowDetail { 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;
ShowDetail = true;
}
#endregion Private Methods
}
}
+123 -1
View File
@@ -1,3 +1,125 @@
<h3>ScrapMan</h3>
<ScrapEditor CanSave="true" RecMSE="@RecMSE" E_Updated="doUpdate"></ScrapEditor>
<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>
@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">
<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>
+178 -18
View File
@@ -1,29 +1,189 @@
using global::System;
using global::System.Collections.Generic;
using global::System.Linq;
using global::System.Threading.Tasks;
using global::Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP_TAB_SERV;
using MP_TAB_SERV.Shared;
using MP_TAB_SERV.Components;
using MP.Data;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
using MP.Data.Services;
using Newtonsoft.Json;
using NLog;
using static EgwCoreLib.Utils.DtUtils;
namespace MP_TAB_SERV.Components
{
public partial class ScrapMan
{
#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 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(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 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 isProcessing = false;
private string noteKo = "";
private int NumRecPage = 10;
private int PageNum = 1;
private bool showInsert = false;
private bool showNote = false;
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
}
}
+1 -3
View File
@@ -6,9 +6,7 @@
}
else
{
<div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<NotesMan RecMSE="CurrMSE"></NotesMan>
}
+13 -3
View File
@@ -34,10 +34,20 @@ else // disegno box cliccabile e licenza ASSISTENZA mancante
{
<div class="card">
<div class="card-header">
<a target="_blank" href="@(fullUrl(CurrItem.AppUrl))" class="btn btn-outline-info btn-block" title="Apri">
<i class="@(traduci($"{CurrItem.AppName}-ICON"))"></i>
@if (hasLic())
{
<a target="_blank" href="@(fullUrl(CurrItem.AppUrl))" class="btn btn-outline-info btn-block" title="Apri">
<i class="@(traduci($"{CurrItem.AppName}-ICON"))"></i>
<h3 class="mb-0">@CurrItem.AppName&nbsp;</h3>
</a>
</a>
}
else
{
<button class="btn btn-outline-secondary btn-block" title="Manca Licenza" disabled>
<i class="@(traduci($"{CurrItem.AppName}-ICON"))"></i>
<h3 class="mb-0">@CurrItem.AppName</h3>
</button>
}
</div>
<div class="card-body">
<div class="row text-muted">
+5 -2
View File
@@ -46,7 +46,6 @@ namespace MP.Land.Components
protected bool authOk()
{
//return false;
bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey);
if (allOk)
{
@@ -56,7 +55,11 @@ namespace MP.Land.Components
MService.YearAuth = true;
}
}
return allOk;
}
protected bool hasLic()
{
bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey);
return allOk;
}
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Land</RootNamespace>
<Version>6.16.2310.1610</Version>
<Version>6.16.2310.1615</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo gestione Programmi MAPO</i>
<h4>Versione: 6.16.2310.1610</h4>
<h4>Versione: 6.16.2310.1615</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2310.1610
6.16.2310.1615
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2310.1610</version>
<version>6.16.2310.1615</version>
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>