Merge branch 'feature/ScratchStatsPages' into develop
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31229.75
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP-STATS", "MP.Stats\MP.Stats.csproj", "{D9901B50-E61C-400C-B62C-FA060CF72C29}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Stats", "MP.Stats\MP.Stats.csproj", "{D9901B50-E61C-400C-B62C-FA060CF72C29}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.csproj", "{10BA8450-301D-49C7-8E1E-21B7469C225C}"
|
||||
EndProject
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool rollBackEntity(object item)
|
||||
public bool RollBackEntity(object item)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
@@ -60,13 +60,33 @@ namespace MP.Data.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella controlli da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ResControlli> StatControlliGetAll(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.ResControlli> dbResult = new List<DatabaseModels.ResControlli>();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetControlli
|
||||
.Where(x => x.Note.Contains(searchVal) || x.IdxMacchina.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
.OrderByDescending(x => x.DataOra)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella scarti da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ResScarti> ScartiGetAll(int numRecord, string searchVal = "")
|
||||
public List<DatabaseModels.ResScarti> StatScartiGetAll(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.ResScarti> dbResult = new List<DatabaseModels.ResScarti>();
|
||||
|
||||
@@ -80,6 +100,26 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella UserLog da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.UserActionLog> StatUserLogGetAll(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.UserActionLog> dbResult = new List<DatabaseModels.UserActionLog>();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetUserLog
|
||||
.Where(x => x.Valore.Contains(searchVal) || x.Cognome.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
.OrderByDescending(x => x.DataOraRif)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -59,12 +59,22 @@ namespace MP.Stats.Data
|
||||
|
||||
public void rollBackEdit(object item)
|
||||
{
|
||||
dbController.rollBackEntity(item);
|
||||
dbController.RollBackEntity(item);
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.ResScarti[]> ScartiGetAll(int numRecord, string searchVal = "")
|
||||
public Task<MP.Data.DatabaseModels.ResControlli[]> StatControlliGetAll(int numRecord, string searchVal = "")
|
||||
{
|
||||
return Task.FromResult(dbController.ScartiGetAll(numRecord, searchVal).ToArray());
|
||||
return Task.FromResult(dbController.StatControlliGetAll(numRecord, searchVal).ToArray());
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.ResScarti[]> StatScartiGetAll(int numRecord, string searchVal = "")
|
||||
{
|
||||
return Task.FromResult(dbController.StatScartiGetAll(numRecord, searchVal).ToArray());
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.UserActionLog[]> StatUserLogGetAll(int numRecord, string searchVal = "")
|
||||
{
|
||||
return Task.FromResult(dbController.StatUserLogGetAll(numRecord, searchVal).ToArray());
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -6,10 +6,54 @@
|
||||
<div class="card">
|
||||
<div class="card-header table-primary h1">Controlli</div>
|
||||
<div class="card-body">
|
||||
elenco controlli
|
||||
@if (currRecord != null)
|
||||
{
|
||||
@*<BasketEditor Basket="@currBasket" DataReset="ResetData" DataUpdated="UpdateData"></BasketEditor>*@
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:70%"></div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@*<th></th>*@
|
||||
<th>Macchina</th>
|
||||
<th>Data</th>
|
||||
<th>ODL/Commessa</th>
|
||||
<th>Articolo</th>
|
||||
<th>Esito</th>
|
||||
<th>Note</th>
|
||||
<th>Operatore</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxControllo)">
|
||||
@*<td><button class="btn btn-sm btn-info" @onclick="() => Edit(record)"><span class="oi oi-pencil"></span></button> <button class="btn btn-sm btn-success" @onclick="() => ShowDocs(record)" title="Vai ai documenti"><span class="oi oi-document"></span></button></td>*@
|
||||
<td>@record.IdxMacchina</td>
|
||||
<td>@record.DataOra</td>
|
||||
<td>@record.IdxOdl</td>
|
||||
<td>@record.CodArticolo</td>
|
||||
<td>@record.EsitoOk</td>
|
||||
<td>@record.Note</td>
|
||||
<td>@record.MatrOpr</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
<div class="card-footer py-1">
|
||||
<div class="row">
|
||||
<div class="col-8 col-lg-10">
|
||||
</div>
|
||||
<div class="col-4 col-lg-2">
|
||||
<DataPager numRecord="@numRecord" numRecordChanged="ForceReload" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,104 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Stats.Data;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Stats.Pages
|
||||
{
|
||||
public partial class Controlli : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private MP.Data.DatabaseModels.ResControlli currRecord = null;
|
||||
|
||||
private MP.Data.DatabaseModels.ResControlli[] ListRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
ListRecords = await StatService.StatControlliGetAll(numRecord, MessageService.SearchVal);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
MessageService.ShowSearch = true;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
ListRecords = await StatService.StatControlliGetAll(numRecord, MessageService.SearchVal);
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
StatService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = await StatService.StatControlliGetAll(numRecord, MessageService.SearchVal);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int IdxControllo)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.IdxControllo == IdxControllo) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public void OnSeachUpdated()
|
||||
{
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="card-header table-primary h1">Main Topics</div>
|
||||
<div class="card-body">
|
||||
<HomeButton NavLink="produzione" Icon="oi oi-book" Descript="Produzione" />
|
||||
<HomeButton NavLink="diario" Icon="oi oi-document" Descript="User Log" />
|
||||
<HomeButton NavLink="userlog" Icon="oi oi-document" Descript="User Log" />
|
||||
<HomeButton NavLink="controlli" Icon="oi oi-beaker" Descript="Controlli" />
|
||||
<HomeButton NavLink="scarti" Icon="oi oi-warning" Descript="Scarti" />
|
||||
@*<HomeButton NavLink="resources" Icon="oi oi-puzzle-piece" Descript="Risorse" />*@
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:70%"></div>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace MP.Stats.Pages
|
||||
protected async Task ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
ListRecords = await StatService.ScartiGetAll(numRecord, MessageService.SearchVal);
|
||||
ListRecords = await StatService.StatScartiGetAll(numRecord, MessageService.SearchVal);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -51,7 +51,7 @@ namespace MP.Stats.Pages
|
||||
numRecord = 10;
|
||||
MessageService.ShowSearch = true;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
ListRecords = await StatService.ScartiGetAll(numRecord, MessageService.SearchVal);
|
||||
ListRecords = await StatService.StatScartiGetAll(numRecord, MessageService.SearchVal);
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
@@ -63,7 +63,7 @@ namespace MP.Stats.Pages
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = await StatService.ScartiGetAll(numRecord, MessageService.SearchVal);
|
||||
ListRecords = await StatService.StatScartiGetAll(numRecord, MessageService.SearchVal);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
@@ -100,48 +100,5 @@ namespace MP.Stats.Pages
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#if false
|
||||
[Inject]
|
||||
protected BBM_SelectData SelectData { get; set; }
|
||||
|
||||
protected void CreateNew()
|
||||
{
|
||||
// recupero counter
|
||||
string newCode = BBMService.CounterGetNext("EGW.B", 6);
|
||||
DatabaseModels.BasketsModel newRecord = new DatabaseModels.BasketsModel()
|
||||
{
|
||||
CodBasket = newCode,
|
||||
DataIns = DateTime.Now,
|
||||
CustomerId = 1,
|
||||
Descript = "New Basket"
|
||||
};
|
||||
currBasket = newRecord;
|
||||
}
|
||||
|
||||
protected async Task Delete(SHERPA.BBM.DatabaseModels.BasketsModel currRecord)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il Basket '{currRecord.CodBasket}'?"))
|
||||
return;
|
||||
|
||||
BBMService.BasketsDelete(currRecord);
|
||||
await UpdateData();
|
||||
}
|
||||
|
||||
protected void Edit(SHERPA.BBM.DatabaseModels.BasketsModel currRecord)
|
||||
{
|
||||
currBasket = currRecord;
|
||||
}
|
||||
|
||||
protected void ShowDocs(SHERPA.BBM.DatabaseModels.BasketsModel currRecord)
|
||||
{
|
||||
// salvo
|
||||
SelectData.BasketId = currRecord.BasketId;
|
||||
SelectData.NegotiationId = 0;
|
||||
// rimando...
|
||||
NavManager.NavigateTo("docs");
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
@page "/userlog"
|
||||
|
||||
@using MP.Stats.Components
|
||||
@using MP.Stats.Data
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary h1">User Log</div>
|
||||
<div class="card-body">
|
||||
@if (currRecord != null)
|
||||
{
|
||||
@*<BasketEditor Basket="@currBasket" DataReset="ResetData" DataUpdated="UpdateData"></BasketEditor>*@
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:70%"></div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@*<th></th>*@
|
||||
<th>Macchina</th>
|
||||
<th>Data</th>
|
||||
<th>ODL/Commessa</th>
|
||||
<th>Articolo</th>
|
||||
<th>Azione</th>
|
||||
<th>Descrizione</th>
|
||||
<th>Operatore</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxLog)">
|
||||
@*<td><button class="btn btn-sm btn-info" @onclick="() => Edit(record)"><span class="oi oi-pencil"></span></button> <button class="btn btn-sm btn-success" @onclick="() => ShowDocs(record)" title="Vai ai documenti"><span class="oi oi-document"></span></button></td>*@
|
||||
<td>@record.IdxMacchina</td>
|
||||
<td>@record.DataOraRif</td>
|
||||
<td>-</td>
|
||||
<td>@record.CodArticolo</td>
|
||||
<td>@record.Azione</td>
|
||||
<td>@record.Valore</td>
|
||||
<td>@record.Cognome @record.Nome</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<div class="row">
|
||||
<div class="col-8 col-lg-10">
|
||||
</div>
|
||||
<div class="col-4 col-lg-2">
|
||||
<DataPager numRecord="@numRecord" numRecordChanged="ForceReload" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,104 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Stats.Data;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Stats.Pages
|
||||
{
|
||||
public partial class UserLog : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private MP.Data.DatabaseModels.UserActionLog currRecord = null;
|
||||
|
||||
private MP.Data.DatabaseModels.UserActionLog[] ListRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
ListRecords = await StatService.StatUserLogGetAll(numRecord, MessageService.SearchVal);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
MessageService.ShowSearch = true;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
ListRecords = await StatService.StatUserLogGetAll(numRecord, MessageService.SearchVal);
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
StatService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = await StatService.StatUserLogGetAll(numRecord, MessageService.SearchVal);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int IdxLog)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.IdxLog == IdxLog) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public void OnSeachUpdated()
|
||||
{
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="diario">
|
||||
<NavLink class="nav-link" href="userlog">
|
||||
<span class="oi oi-document" aria-hidden="true" title="Statistiche Controlli"></span> User ActionLog
|
||||
</NavLink>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user