Continuo setup preliminare pagina parametri

This commit is contained in:
Samuele E. Locatelli
2021-10-23 19:03:55 +02:00
parent 6fb3ed9664
commit dcfd321b37
7 changed files with 47 additions and 161 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>1.0.2110.2318</Version>
<Version>1.0.2110.2319</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
+1 -3
View File
@@ -269,9 +269,7 @@ namespace GWMS.UI.Pages
{
SearchRecords = await DataService.PlantsAnalisysGetByCode(AppMService.Order_Filter);
SearchRecords = SearchRecords.Where(x => x.HasRefill || !_ShowOnlyRefill).ToList();
ListRecords = SearchRecords
.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
catch (Exception exc)
{
+17 -50
View File
@@ -42,7 +42,8 @@
<div class="card-body p-1">
@if (currRecord != null)
{
<OrderAdminEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData" SupplierId="@currRecord.SupplierId"></OrderAdminEditor>
<i>Editor parametri</i>
@*<OrderAdminEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData" SupplierId="@currRecord.SupplierId"></OrderAdminEditor>*@
}
@if (ListRecords == null)
{
@@ -59,63 +60,30 @@
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th>Impianto</th>
<th>Data</th>
<th>Livello Apertura</th>
<th>Livello Chiusura</th>
<th class="text-right">Carico <i class="fas fa-truck-moving"></i></th>
<th class="text-right">Ordine <i class="fas fa-file"></i></th>
<th>Parametro</th>
<th>Valore attuale/richiesto</th>
<th>Update</th>
<th class="text-right">Last message</th>
@*<th class="text-right">Carico <i class="fas fa-truck-moving"></i></th>
<th class="text-right">Ordine <i class="fas fa-file"></i></th>*@
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
@*<tr class="@checkSelect(@record.OrderId)">*@
<tr>
<tr class="@checkSelect(@record.uid)">
<td>
<div>@record.PlantCode</div>
<div class="small">@record.PlantDesc</div>
<div>@record.name</div>
<div class="small">@record.uid</div>
</td>
<td>
<div>@record.DataRif.ToString("yyyy.MM.dd")</div>
<div class="small">@record.DataRif.ToString("dddd")</div>
<div>@record.value</div>
<div class="small">@record.reqValue</div>
</td>
<td>@record.LevelStart.ToString("N0")</td>
<td>@record.LevelEnd.ToString("N0")</td>
<td class="text-right">
@if (record.HasRefill)
{
if (record.HasOrder)
{
<span class="text-success">@record.LevelMin.ToString("N0") <i class="fas fa-sort-amount-up"></i> @record.LevelMax.ToString("N0")</span>
}
else
{
<span class="text-danger">@record.LevelMin.ToString("N0") <i class="fas fa-sort-amount-up"></i> @record.LevelMax.ToString("N0")</span>
}
}
</td>
<td class="text-right">
@if (record.HasOrder)
{
@if (currRecord == null)
{
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)" title="Edit Ordine">
<span><i class="fas fa-truck-moving"></i></span>
</button>
}
else
{
<button class="btn btn-sm btn-secondary disabled">
<span><i class="fas fa-truck-moving"></i></span>
</button>
}
}
else if (ShowAddNew && record.HasRefill)
{
<button class="btn btn-sm btn-success" @onclick="() => CreateNew(record)" title="Aggiunta nuovo Ordine"><i class="far fa-calendar-plus"></i></button>
}
<td>@record.lastRead.ToString("yyyy.MM.dd hh:mm:ss")</td>
<td>
<div>@record.lastMessage</div>
<div class="small">@record.lastRequest</div>
</td>
</tr>
}
@@ -126,6 +94,5 @@
}
</div>
<div class="card-footer p-1">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
+25 -104
View File
@@ -10,6 +10,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static GWMS.Data.IobObjects;
namespace GWMS.UI.Pages
{
@@ -19,13 +20,9 @@ namespace GWMS.UI.Pages
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private bool _ShowOnlyRefill = false;
private OrderModel currRecord = null;
private List<PlantLevSumDTO> ListRecords;
private objItem currRecord = null;
private List<objItem> ListRecords;
private List<PlantDTO> PlantsList;
private List<PlantLevSumDTO> SearchRecords;
private List<SupplierModel> SuppliersList;
#endregion Private Fields
@@ -40,40 +37,8 @@ namespace GWMS.UI.Pages
#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 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
@@ -96,42 +61,23 @@ namespace GWMS.UI.Pages
}
}
private int SelSupplierId
private string SelPlantCode
{
get
{
int answ = 0;
if (AppMService.Order_Filter != null)
string answ = "";
// cerco in elenco
var currPlant = PlantsList
.Where(x => x.PlantId == SelPlantId)
.FirstOrDefault();
if (currPlant != null)
{
answ = AppMService.Order_Filter.SupplierId;
answ = currPlant.PlantCode;
}
return answ;
}
set
{
if (!AppMService.Order_Filter.SupplierId.Equals(value))
{
AppMService.Order_Filter.SupplierId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
private bool ShowOnlyRefill
{
get
{
return _ShowOnlyRefill;
}
set
{
_ShowOnlyRefill = value;
currPage = 1;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
#endregion Private Properties
@@ -201,9 +147,9 @@ namespace GWMS.UI.Pages
get
{
int answ = 0;
if (SearchRecords != null)
if (ListRecords != null)
{
answ = SearchRecords.Count;
answ = ListRecords.Count;
}
return answ;
}
@@ -213,15 +159,6 @@ namespace GWMS.UI.Pages
#region Public Properties
public bool ShowAddNew
{
get
{
bool answ = false;
answ = (SelSupplierId > 0 && SelPlantId > 0);
return answ;
}
}
#endregion Public Properties
@@ -267,11 +204,7 @@ namespace GWMS.UI.Pages
ListRecords = null;
try
{
SearchRecords = await DataService.PlantsAnalisysGetByCode(AppMService.Order_Filter);
SearchRecords = SearchRecords.Where(x => x.HasRefill || !_ShowOnlyRefill).ToList();
ListRecords = SearchRecords
.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
ListRecords = await DataService.getCurrObjItems(SelPlantCode);
}
catch (Exception exc)
{
@@ -284,14 +217,14 @@ namespace GWMS.UI.Pages
#region Protected Methods
#if false
/// <summary>
/// Creazione nuovo record Ordine
/// </summary>
protected void CreateNew(PlantLevSumDTO currItem)
{
var currPlant = PlantsList.Where(x => x.PlantId == SelPlantId).FirstOrDefault();
var currSuppl = SuppliersList.Where(x => x.SupplierId == SelSupplierId).FirstOrDefault();
if (currPlant != null && currSuppl != null)
if (currPlant != null)
{
DateTime ordDate = currItem.DataRif.AddDays(-1);
// creo un nuovo record
@@ -310,36 +243,26 @@ namespace GWMS.UI.Pages
ExecutionQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / currItem.DeltaMin) * currItem.DeltaMin,
OrderQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / 2000) * 2000
};
//// aggiorno filtro
//AppMService.Order_Filter = SelectOrderData.Init(5, 10);
}
}
}
#endif
protected void Edit(PlantLevSumDTO selRecord)
protected void Edit(objItem selRecord)
{
// rileggo dal DB il record corrente...
var pUpd = Task.Run(async () =>
{
currRecord = await DataService.OrderGetById(selRecord.OrdersIds.FirstOrDefault());
currRecord = selRecord;
});
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 = "Ordini";
AppMService.PageIcon = "fas fa-file-invoice pr-2";
AppMService.PageName = "Parametri Impianto";
AppMService.PageIcon = "fas fa-folder-open pr-2";
AppMService.EA_SearchUpdated += OnSeachUpdated;
await ReloadAllData();
}
@@ -347,7 +270,6 @@ namespace GWMS.UI.Pages
protected async Task ReloadAllData()
{
isLoading = true;
SuppliersList = await DataService.SuppliersGetAll();
PlantsList = null;
await GetClaimsData();
// se ho un plantId valido --> altrimenti non abilitato
@@ -379,14 +301,13 @@ namespace GWMS.UI.Pages
{
SelPlantId = 0;
currRecord = null;
SearchRecords = null;
ListRecords = null;
AppMService.Order_Filter = SelectOrderData.Init(5, 10);
await DataService.PlantsAnalisysReset(AppMService.Order_Filter);
await ReloadAllData();
}
protected void Select(OrderModel selRecord)
protected void Select(objItem selRecord)
{
// applico filtro da selezione
currRecord = selRecord;
@@ -403,14 +324,14 @@ namespace GWMS.UI.Pages
#region Public Methods
public string checkSelect(int OrderId)
public string checkSelect(string uid)
{
string answ = "";
if (currRecord != null)
{
try
{
answ = (currRecord.OrderId == OrderId) ? "table-info" : "";
answ = (currRecord.uid == uid) ? "table-info" : "";
}
catch
{ }
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GWMS - Gas Warehouse Management System</i>
<h4>Versione: 1.0.2110.2318</h4>
<h4>Versione: 1.0.2110.2319</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.0.2110.2318
1.0.2110.2319
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2110.2318</version>
<version>1.0.2110.2319</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>