Update gestione allarmi: deduplica prima dir ecuperare
Update visualizzazione ordini (/mostra richiesta sel) Update gestione buttons vari
This commit is contained in:
@@ -30,6 +30,30 @@ namespace GWMS.Data.Controllers
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue pulizia allarmi impianto richiesto
|
||||
/// </summary>
|
||||
/// <param name="PlantId"></param>
|
||||
/// <returns></returns>
|
||||
public int AlarmLogCleanDup(int PlantId)
|
||||
{
|
||||
int numMod = 0;
|
||||
using (GWMSContext localDbCtx = new GWMSContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
// eseguo stored
|
||||
string sqlCommand = $"CALL stp_deleteDuplicatedAlarms ({PlantId});";
|
||||
numMod = localDbCtx.Database.ExecuteSqlRaw(sqlCommand);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in AlarmLogCleanDup{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return numMod;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero elenco allarmi (ultimi?)
|
||||
/// </summary>
|
||||
|
||||
@@ -180,14 +180,24 @@ namespace GWMS.UI.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione cleanup + recupero allarmi
|
||||
/// </summary>
|
||||
/// <param name="PlantId"></param>
|
||||
/// <param name="skipRec"></param>
|
||||
/// <param name="numRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AlarmLogModel>> AlarmLogGetFilt(int PlantId, int skipRec, int numRec)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
// effettuo pulizia
|
||||
var numClean = dbController.AlarmLogCleanDup(PlantId);
|
||||
// restituisco elenco
|
||||
var dbResult = dbController.AlarmLogGetFilt(PlantId, skipRec, numRec);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"Effettuata lettura da DB AlarmLogGetFilt: {ts.TotalMilliseconds} ms");
|
||||
Log.Debug($"Effettuato dedup + lettura da DB AlarmLogGetFilt: {ts.TotalMilliseconds} ms");
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>1.0.2509.2211</Version>
|
||||
<Version>1.0.2510.1515</Version>
|
||||
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@using GWMS.UI.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="card-header table-primary px-1">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-2 h3">
|
||||
Elenco Ordini
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<div class="form-group mb-0">
|
||||
<Button id="btnReset" class="btn btn-info btn-sm btn-block" Clicked="ResetFilter" title="Reset Filter"><span class="oi oi-loop-circular"></span></Button>
|
||||
<button id="btnReset" class="btn btn-info btn-sm btn-block" @onclick="@ResetFilter" title="Reset Filter"><span class="oi oi-loop-circular"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
@@ -37,16 +37,12 @@
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">inizio:</span>
|
||||
</div>
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-calendar"></span>
|
||||
</span>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">fine:</span>
|
||||
<span class="input-group-text">→</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
|
||||
</div>
|
||||
@@ -72,10 +68,6 @@
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-industry" aria-hidden="true"></span>
|
||||
|
||||
@@ -28,24 +28,24 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-4 text-right">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">inizio:</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">fine:</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">inizio:</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">fine:</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-4 text-right">
|
||||
<div class="d-flex justify-content-between">
|
||||
@@ -180,9 +180,16 @@
|
||||
</button>
|
||||
}
|
||||
}
|
||||
else if (ShowAddNew && record.HasRefill)
|
||||
else if (record.HasRefill)
|
||||
{
|
||||
<button class="btn btn-sm btn-success" @onclick="() => CreateNew(record)" title="Aggiunta nuovo Ordine"><i class="far fa-calendar-plus"></i></button>
|
||||
if (ShowAddNew)
|
||||
{
|
||||
<button class="btn btn-sm btn-success" @onclick="() => CreateNew(record)" title="Aggiunta nuovo Ordine"><i class="far fa-calendar-plus"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="bg-warning text-center p-1 small text-danger" title="Selezionare Fornitore"><i class="fas fa-industry"></i> <i class="fas fa-arrow-up"></i></div>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -10,19 +10,18 @@
|
||||
Ordini Fornitore
|
||||
</div>
|
||||
<div class="col-12 col-lg-4 text-right">
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">inizio:</span>
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-calendar"></span>
|
||||
</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">fine:</span>
|
||||
<span class="input-group-text">→</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
|
||||
</div>
|
||||
@@ -48,10 +47,6 @@
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-industry" aria-hidden="true"></span>
|
||||
|
||||
+232
-205
@@ -15,6 +15,216 @@ namespace GWMS.UI.Pages
|
||||
[Authorize(Roles = "SuperAdmin, Admin, ExtUser")]
|
||||
public partial class Suppliers : ComponentBase, IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public string SupplierIdReq { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int OrderId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.OrderId == OrderId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Valore SupplierId filtrato da claim
|
||||
/// </summary>
|
||||
protected int ClaimSupplierId = -1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
protected DateTime DateEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddDays(1);
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.DateEnd;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.DateEnd.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.DateEnd = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected DateTime DateStart
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddDays(-1);
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.DateStart;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.DateStart.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.DateStart = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Edit(OrderModel selRecord)
|
||||
{
|
||||
// rileggo dal DB il record corrente...
|
||||
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCode(selRecord.OrderCode));
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Fornitore";
|
||||
AppMService.PageIcon = "fas fa-industry pr-2";
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
ShowClosed = false;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
PlantsList = await DataService.PlantsList();
|
||||
SelSupplierId = 0;
|
||||
SuppliersList = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
if (ClaimSupplierId == 0)
|
||||
{
|
||||
SuppliersList = await DataService.SuppliersGetAll();
|
||||
}
|
||||
else if (ClaimSupplierId > 0)
|
||||
{
|
||||
var rawData = await DataService.SuppliersGetAll();
|
||||
SuppliersList = rawData.Where(x => x.SupplierId == ClaimSupplierId).ToList();
|
||||
SelSupplierId = ClaimSupplierId;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlantsList = new List<PlantDetailModel>();
|
||||
}
|
||||
isLoading = false;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
DataService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task ResetFilter(SelectOrderData newFilter)
|
||||
{
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
AppMService.Order_Filter = SelectOrderData.Init(5, 7);
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void Select(OrderModel selRecord)
|
||||
{
|
||||
// applico filtro da selezione
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private OrderModel currRecord = null;
|
||||
@@ -26,15 +236,6 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Valore SupplierId filtrato da claim
|
||||
/// </summary>
|
||||
protected int ClaimSupplierId = -1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
@@ -115,91 +316,30 @@ namespace GWMS.UI.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShowClosed
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = true;
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.ShowClosed;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.ShowClosed.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.ShowClosed = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GWMSDataService DataService { get; set; }
|
||||
|
||||
protected DateTime DateEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddDays(1);
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.DateEnd;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.DateEnd.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.DateEnd = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected DateTime DateStart
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddDays(-1);
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.DateStart;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.DateStart.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.DateStart = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public string SupplierIdReq { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -245,118 +385,5 @@ namespace GWMS.UI.Pages
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Edit(OrderModel selRecord)
|
||||
{
|
||||
// rileggo dal DB il record corrente...
|
||||
var pUpd = Task.Run(async () => currRecord = await DataService.OrderGetByCode(selRecord.OrderCode));
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Fornitore";
|
||||
AppMService.PageIcon = "fas fa-industry pr-2";
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
PlantsList = await DataService.PlantsList();
|
||||
SelSupplierId = 0;
|
||||
SuppliersList = null;
|
||||
await GetClaimsData();
|
||||
// se ho un plantId valido --> altrimenti non abilitato
|
||||
if (ClaimSupplierId == 0)
|
||||
{
|
||||
SuppliersList = await DataService.SuppliersGetAll();
|
||||
}
|
||||
else if (ClaimSupplierId > 0)
|
||||
{
|
||||
var rawData = await DataService.SuppliersGetAll();
|
||||
SuppliersList = rawData.Where(x => x.SupplierId == ClaimSupplierId).ToList();
|
||||
SelSupplierId = ClaimSupplierId;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlantsList = new List<PlantDetailModel>();
|
||||
}
|
||||
isLoading = false;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
DataService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task ResetFilter(SelectOrderData newFilter)
|
||||
{
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
AppMService.Order_Filter = SelectOrderData.Init(5, 7);
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
protected void Select(OrderModel selRecord)
|
||||
{
|
||||
// applico filtro da selezione
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int OrderId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.OrderId == OrderId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -3,86 +3,92 @@
|
||||
@using GWMS.UI.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary pb-0 mb-0">
|
||||
<div class="card-header table-primary pb-0 mb-0 px-1">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-6 pr-0 col-lg-8 h3 mb-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-1 h3">
|
||||
Consegne
|
||||
</div>
|
||||
<div class="col-6 col-lg-4">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<button class="btn btn-sm btn-block btn-secondary" @onclick="() => ToggleFiltPeriod()"><i class="far fa-calendar-alt"></i> <i class="@icnFiltTime"></i></button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button class="btn btn-sm btn-block btn-secondary" @onclick="() => ToggleFiltDest()"><i class="fas fa-gas-pump"></i> <i class="@icnFiltDest"></i></button>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<div class="d-flex">
|
||||
@if (!showFiltTime)
|
||||
{
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-primary px-4" @onclick="() => ToggleFiltPeriod()"><i class="far fa-calendar-alt"></i> <i class="fas fas fa-chevron-down"></i></button>
|
||||
</div>
|
||||
}
|
||||
@if (!showFiltDest)
|
||||
{
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-primary px-4" @onclick="() => ToggleFiltDest()"><i class="fas fa-gas-pump"></i> <i class="fas fas fa-chevron-down"></i></button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 text-right">
|
||||
<div class="d-flex small mb-1">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-truck-moving" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="SelTranspId" class="form-control form-control-sm" title="Trasportatore">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (TransportersList != null)
|
||||
{
|
||||
foreach (var item in TransportersList)
|
||||
{
|
||||
<option value="@item.TransporterId">@item.TransporterCode | @item.TransporterDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@if (showFiltTime)
|
||||
{
|
||||
<div class="row small">
|
||||
<div class="col-6">
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
|
||||
<div class="d-flex small mb-1">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-calendar"></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateStart"></input>
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">→</span>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" type="date" @bind="@DateEnd"></input>
|
||||
<button class="btn btn-sm btn-info" @onclick="() => ToggleFiltPeriod()"><i class="far fa-calendar-alt"></i> <i class="fas fa-chevron-up"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (showFiltDest)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-gas-pump" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="@SelPlantId" class="form-control form-control-sm">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (PlantsList != null)
|
||||
{
|
||||
foreach (var item in PlantsList)
|
||||
{
|
||||
<option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="d-flex small mb-1">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="fas fa-truck-moving" aria-hidden="true"></span>
|
||||
<span class="fas fa-gas-pump"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="SelTranspId" class="form-control form-control-sm" title="Trasportatore">
|
||||
<select @bind="@SelPlantId" class="form-control form-control-sm">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@if (TransportersList != null)
|
||||
@if (PlantsList != null)
|
||||
{
|
||||
foreach (var item in TransportersList)
|
||||
foreach (var item in PlantsList)
|
||||
{
|
||||
<option value="@item.TransporterId">@item.TransporterCode | @item.TransporterDesc</option>
|
||||
<option value="@item.PlantId">@item.PlantCode | @item.PlantDesc</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<button class="btn btn-sm btn-info" @onclick="() => ToggleFiltDest()"><i class="fas fa-gas-pump"></i> <i class="fas fas fa-chevron-up"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+201
-182
@@ -15,16 +15,35 @@ namespace GWMS.UI.Pages
|
||||
[Authorize(Roles = "SuperAdmin, Admin, ExtTransp")]
|
||||
public partial class Transporters : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
#region Public Methods
|
||||
|
||||
private OrderModel currRecord = null;
|
||||
public string checkSelect(int OrderId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.OrderId == OrderId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private List<OrderModel> ListRecords;
|
||||
private List<PlantDetailModel> PlantsList;
|
||||
private List<OrderModel> SearchRecords;
|
||||
private List<TransporterModel> TransportersList;
|
||||
public void Dispose()
|
||||
{
|
||||
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
#endregion Private Fields
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
@@ -34,114 +53,6 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
|
||||
private int _numRecord { get; set; } = 10;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => _currPage;
|
||||
set
|
||||
{
|
||||
if (_currPage != value)
|
||||
{
|
||||
_currPage = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string icnFiltDest
|
||||
{
|
||||
get
|
||||
{
|
||||
return showFiltDest ? "fas fa-chevron-up" : "fas fa-chevron-down";
|
||||
}
|
||||
}
|
||||
|
||||
private string icnFiltTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return showFiltTime ? "fas fa-chevron-up" : "fas fa-chevron-down";
|
||||
}
|
||||
}
|
||||
|
||||
private string icnFiltTran
|
||||
{
|
||||
get
|
||||
{
|
||||
return showFiltTrasp ? "fas fa-chevron-up" : "fas fa-chevron-down";
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => _numRecord;
|
||||
set
|
||||
{
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int SelPlantId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
currRecord = null;
|
||||
AppMService.Order_Filter.PlantId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int SelTranspId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.TransporterId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.TransporterId.Equals(value))
|
||||
{
|
||||
currRecord = null;
|
||||
AppMService.Order_Filter.TransporterId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
@@ -204,9 +115,7 @@ namespace GWMS.UI.Pages
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
protected bool showFiltDest { get; set; } = false;
|
||||
|
||||
protected bool showFiltTime { get; set; } = false;
|
||||
|
||||
protected bool showFiltTrasp { get; set; } = false;
|
||||
|
||||
protected int totalCount
|
||||
@@ -224,55 +133,6 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Claims dell'utente...
|
||||
///
|
||||
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task GetClaimsData()
|
||||
{
|
||||
ClaimTransporterId = -1;
|
||||
// recupero auth
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
// se autenticato --> controllo i claims
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
// cerco il claim PlantId...
|
||||
var supplierClaim = user.FindFirst(c => c.Type == "TransporterId")?.Value;
|
||||
int.TryParse(supplierClaim, out ClaimTransporterId);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClaimTransporterId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDateEndChanged(DateTime? date)
|
||||
{
|
||||
currRecord = null;
|
||||
DateEnd = (DateTime)date;
|
||||
}
|
||||
|
||||
private void OnDateStartChanged(DateTime? date)
|
||||
{
|
||||
currRecord = null;
|
||||
DateStart = (DateTime)date;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Edit(OrderModel selRecord)
|
||||
@@ -292,7 +152,7 @@ namespace GWMS.UI.Pages
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
SelPlantId = 0;
|
||||
SelTranspId = 0;
|
||||
@@ -300,6 +160,11 @@ namespace GWMS.UI.Pages
|
||||
AppMService.PageName = "Fornitore";
|
||||
AppMService.PageIcon = "fas fa-industry pr-2";
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
ShowClosed = false;
|
||||
await ReloadAllData();
|
||||
}
|
||||
|
||||
@@ -377,34 +242,188 @@ namespace GWMS.UI.Pages
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
#region Private Fields
|
||||
|
||||
public string checkSelect(int OrderId)
|
||||
private OrderModel currRecord = null;
|
||||
|
||||
private List<OrderModel> ListRecords;
|
||||
private List<PlantDetailModel> PlantsList;
|
||||
private List<OrderModel> SearchRecords;
|
||||
private List<TransporterModel> TransportersList;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
|
||||
private int _numRecord { get; set; } = 10;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
get => _currPage;
|
||||
set
|
||||
{
|
||||
try
|
||||
if (_currPage != value)
|
||||
{
|
||||
answ = (currRecord.OrderId == OrderId) ? "table-info" : "";
|
||||
_currPage = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
private string icnFiltDest
|
||||
{
|
||||
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
get => showFiltDest ? "fas fa-chevron-up" : "fas fa-chevron-down";
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
private string icnFiltTime
|
||||
{
|
||||
await UpdateData();
|
||||
StateHasChanged();
|
||||
get => showFiltTime ? "fas fa-chevron-up" : "fas fa-chevron-down";
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
private string icnFiltTran
|
||||
{
|
||||
get
|
||||
{
|
||||
return showFiltTrasp ? "fas fa-chevron-up" : "fas fa-chevron-down";
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => _numRecord;
|
||||
set
|
||||
{
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int SelPlantId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.PlantId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.PlantId.Equals(value))
|
||||
{
|
||||
currRecord = null;
|
||||
AppMService.Order_Filter.PlantId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int SelTranspId
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.TransporterId;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.TransporterId.Equals(value))
|
||||
{
|
||||
currRecord = null;
|
||||
AppMService.Order_Filter.TransporterId = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShowClosed
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = true;
|
||||
if (AppMService.Order_Filter != null)
|
||||
{
|
||||
answ = AppMService.Order_Filter.ShowClosed;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.Order_Filter.ShowClosed.Equals(value))
|
||||
{
|
||||
AppMService.Order_Filter.ShowClosed = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Claims dell'utente...
|
||||
///
|
||||
/// https://docs.microsoft.com/it-it/aspnet/core/blazor/security/?view=aspnetcore-5.0
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task GetClaimsData()
|
||||
{
|
||||
ClaimTransporterId = -1;
|
||||
// recupero auth
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
// se autenticato --> controllo i claims
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
// cerco il claim PlantId...
|
||||
var supplierClaim = user.FindFirst(c => c.Type == "TransporterId")?.Value;
|
||||
int.TryParse(supplierClaim, out ClaimTransporterId);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClaimTransporterId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDateEndChanged(DateTime? date)
|
||||
{
|
||||
currRecord = null;
|
||||
DateEnd = (DateTime)date;
|
||||
}
|
||||
|
||||
private void OnDateStartChanged(DateTime? date)
|
||||
{
|
||||
currRecord = null;
|
||||
DateStart = (DateTime)date;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await DataService.OrdersGetFilt(AppMService.Order_Filter);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GWMS - Gas Warehouse Management System</i>
|
||||
<h4>Versione: 1.0.2509.2211</h4>
|
||||
<h4>Versione: 1.0.2510.1515</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.2509.2211
|
||||
1.0.2510.1515
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.0.2509.2211</version>
|
||||
<version>1.0.2510.1515</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user