Refresh pagina aggiornato

Inizio gestione base URL rivisitato
riconf visualizzazione x usare dati PlantLevelDTO
This commit is contained in:
Samuele Locatelli
2024-06-05 16:23:49 +02:00
parent 82d167bfef
commit afb4d5d2cc
19 changed files with 248 additions and 168 deletions
+1 -1
View File
@@ -261,7 +261,7 @@ namespace GWMS.Data.Controllers
/// <param name="DtStart">data inizio</param>
/// <param name="DtEnd">data fine</param>
/// <returns></returns>
public List<PlantLevSumDTO> GetPlantLogSummary(int PlantId, DateTime DtStart, DateTime DtEnd)
public List<PlantLevSumDTO> GetPlantLevSumDto(int PlantId, DateTime DtStart, DateTime DtEnd)
{
List<PlantLevSumDTO> dbResult = new List<PlantLevSumDTO>();
if (PlantId > 0)
-6
View File
@@ -8,9 +8,3 @@
</div>
</div>
@code {
protected DateTime adesso = DateTime.Now;
Version version = typeof(Program).Assembly.GetName().Version;
}
+79
View File
@@ -0,0 +1,79 @@
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;
using System;
using System.Threading.Tasks;
namespace GWMS.UI.Components
{
public partial class CmpFooter : IDisposable
{
#region Public Methods
public void Dispose()
{
if (aTimer != null)
{
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Dispose();
}
}
public void ElapsedTimer(Object source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
adesso = DateTime.Now;
await InvokeAsync(StateHasChanged);
});
pUpd.Wait();
}
public void StartTimer()
{
if (aTimer != null)
{
aTimer.Stop();
aTimer.Dispose();
}
int tOutPeriod = 1000;
aTimer = new System.Timers.Timer(tOutPeriod);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
aTimer.Start();
}
#endregion Public Methods
#region Protected Fields
protected DateTime adesso = DateTime.Now;
#endregion Protected Fields
#region Protected Methods
protected override void OnInitialized()
{
var rawVers = typeof(Program).Assembly.GetName().Version;
version = rawVers != null ? rawVers : new Version("0.0.0.0");
StartTimer();
}
#endregion Protected Methods
#region Private Fields
private System.Timers.Timer aTimer = null!;
private Version? version = null!;
#endregion Private Fields
#region Private Properties
[Inject]
private IConfiguration Configuration { get; set; }
#endregion Private Properties
}
}
-13
View File
@@ -299,17 +299,4 @@
return q[parmName] ?? "";
}
///// <summary>
///// Restituisce URL immagine QRCode
///// </summary>
///// <param name="QrValue">Parametro da renderizzare con QRCode</param>
///// <returns></returns>
//protected string getImgUrl(object QrValue)
//{
// string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val=";
// string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
// string answ = $"{baseUrl}{payload}";
// return answ;
//}
}
@@ -161,17 +161,4 @@
transpList = await DataService.TransportersGetAll();
}
///// <summary>
///// Restituisce URL immagine QRCode
///// </summary>
///// <param name="QrValue">Parametro da renderizzare con QRCode</param>
///// <returns></returns>
//protected string getImgUrl(object QrValue)
//{
// string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val=";
// string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
// string answ = $"{baseUrl}{payload}";
// return answ;
//}
}
@@ -114,17 +114,4 @@
transpList = await DataService.TransportersGetAll();
}
///// <summary>
///// Restituisce URL immagine QRCode
///// </summary>
///// <param name="QrValue">Parametro da renderizzare con QRCode</param>
///// <returns></returns>
//protected string getImgUrl(object QrValue)
//{
// string baseUrl = $"{Configuration["ZCodeUrl"]}/HOME/QR_site/JSON?val=";
// string payload = "{'baseUrl':'{0}','parameters':['" + $"{QrValue}" + "']}";
// string answ = $"{baseUrl}{payload}";
// return answ;
//}
}
+39 -19
View File
@@ -17,15 +17,15 @@
</div>
@*<div class="row py-0">
<div class="col-4 col-md-6 col-lg-8 font-weight-bold">
<h2 class="mb-0">@currItem.PlantCode</h2>
</div>
<div class="col-8 col-md-6 col-lg-4 pl-0 text-right align-bottom">
<button class="btn btn-primary btn-block" @onclick="() => ShowDetail(currItem.PlantId)">
<b>@currItem.PlantDesc&nbsp;<i class="fas fa-angle-double-right"></i></b>
</button>
</div>
</div>*@
<div class="col-4 col-md-6 col-lg-8 font-weight-bold">
<h2 class="mb-0">@currItem.PlantCode</h2>
</div>
<div class="col-8 col-md-6 col-lg-4 pl-0 text-right align-bottom">
<button class="btn btn-primary btn-block" @onclick="() => ShowDetail(currItem.PlantId)">
<b>@currItem.PlantDesc&nbsp;<i class="fas fa-angle-double-right"></i></b>
</button>
</div>
</div>*@
}
</div>
<div class="card-body p-0 p-md-1 p-lg-2">
@@ -121,32 +121,52 @@
</li>
<li class="list-group-item d-flex justify-content-between align-items-center p-1 p-md-2">
<div class="col-6">
@if (currItem.SoldTS != null && currItem.SoldTS.Count > 0 && currItem.SoldTS[0].ValDouble > 0)
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Ieri: </div>
@if (PlantLevelDto != null && PlantLevelDto.Count > 1)
{
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Ieri: </div>
<div style="font-size:1.2em;"><b>@currItem.SoldTS[0].ValDouble.ToString("N1")</b> <span class="small"> <sub>kg</sub></span></div>
@if (PlantLevelDto[1].QtaVenduta > 0)
{
<div style="font-size:1.2em;"><b>@($"{PlantLevelDto[1].QtaVenduta:N0}")</b> <span class="small"> <sub>kg</sub></span></div>
@* <div style="font-size:1.2em;" class="text-secondary"><b>@($"{currItem.SoldTS[0].ValDouble:N0}")</b> <span class="small"> <sub>kg</sub></span></div> *@
}
else
{
<div style="font-size:1.2em;"><b>ND</b> <span class="small"></span></div>
<div style="font-size:0.8em;"><span class="small text-danger">(<i>@($"{PlantLevelDto[1].QtaVenduta:N0}")<sub>kg</sub></i>)</span></div>
}
}
else
{
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Ieri: </div>
<div style="font-size:1.2em;"><b>ND</b> <span class="small"> <sub>kg</sub></span></div>
<LoadingDataSmall></LoadingDataSmall>
}
</div>
<div class="col-6 text-right">
@if (currItem.SoldTS != null && currItem.SoldTS.Count > 1 && currItem.SoldTS[1].ValDouble > 0)
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Oggi: </div>
@if (PlantLevelDto != null && PlantLevelDto.Count > 0)
{
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Oggi: </div>
<div style="font-size:1.2em;"><b>@currItem.SoldTS[1].ValDouble.ToString("N1")</b> <span class="small"> <sub>kg</sub></span></div>
@if (PlantLevelDto[0].QtaVenduta > 0)
{
<div style="font-size:1.2em;"><b>@($"{PlantLevelDto[0].QtaVenduta:N0}")</b> <span class="small"> <sub>kg</sub></span></div>
@* <div style="font-size:1.2em;" class="text-secondary"><b>@($"{currItem.SoldTS[1].ValDouble:N0}")</b> <span class="small"> <sub>kg</sub></span></div> *@
}
else
{
<div style="font-size:1.2em;"><b>ND</b> <span class="small"></span></div>
<div style="font-size:0.8em;"><span class="small text-danger">(<i>@($"{PlantLevelDto[0].QtaVenduta:N0}") <sub>kg</sub></i>)</span></div>
}
}
else
{
<div><i class="fas fa-file-invoice-dollar"></i> Venduto Oggi: </div>
<div style="font-size:1.2em;"><b>ND</b> <span class="small"> <sub>kg</sub></span></div>
<LoadingDataSmall></LoadingDataSmall>
}
</div>
</li>
</ul>
</div>
<div class="col-12 small text-right">
<sup class="px-1">updated: @($"{DateTime.Now:HH:mm:ss}")</sup>
</div>
</div>
</div>
</div>
+87 -75
View File
@@ -13,59 +13,6 @@ namespace GWMS.UI.Components
{
public partial class PlantOverview
{
#region Protected Fields
protected PlantDTO _currItem = new PlantDTO();
protected List<chartJsData.chartJsTSerie> LevelVal = new List<chartJsData.chartJsTSerie>();
/// <summary>
/// fattore di riduzione x visualizzare meno punti (in base alla numerosità...
/// </summary>
protected int redFact = 1;
#endregion Protected Fields
#region Private Properties
[Inject]
private IConfiguration Configuration { get; set; }
[Inject]
private NavigationManager NavManager { get; set; }
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))
{
AppMService.Order_Filter.PlantId = value;
}
}
}
#endregion Private Properties
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
#endregion Protected Properties
#region Public Properties
public string checkRTime
@@ -87,6 +34,16 @@ namespace GWMS.UI.Components
{
var dataReload = Task.Run(async () =>
{
// legge i valori di plantLog ultimi 2 gg...
SelectOrderData plantLevFilt = new SelectOrderData()
{
PlantId = value.PlantId,
DateEnd = DateTime.Today.AddDays(1),
DateStart = DateTime.Today.AddDays(-1),
ShowClosed = false
};
PlantLevelDto = await DataService.PlantsAnalisysGetByCode(plantLevFilt);
// aggiunta delay o non riesce a disegnare
int ChartWaitDelay = 150;
int.TryParse(Configuration["ChartWaitDelay"], out ChartWaitDelay);
@@ -116,25 +73,42 @@ namespace GWMS.UI.Components
#endregion Public Properties
#region Private Methods
#region Public Methods
private void fixRedFactor()
public string getPressData(string valore, string formato)
{
int answ = 1;
int numCount = _currItem.LevelTS.Count;
// passo a 2h se > 3 gg
if (numCount > 240)
answ = 5;
// passo a 3h se > 5 gg
else if (numCount > 120)
answ = 4;
// passo a 4h se > 10 gg
else if (numCount > 72)
answ = 3;
redFact = answ;
string answ = "";
if (currItem.PressAct.ContainsKey(valore))
{
answ = currItem.PressAct[valore].ToString(formato);
}
return answ;
}
#endregion Private Methods
#endregion Public Methods
#region Protected Fields
protected PlantDTO _currItem = new PlantDTO();
protected List<chartJsData.chartJsTSerie> LevelVal = new List<chartJsData.chartJsTSerie>();
/// <summary>
/// fattore di riduzione x visualizzare meno punti (in base alla numerosità...
/// </summary>
protected int redFact = 1;
#endregion Protected Fields
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected GWMSDataService DataService { get; set; }
#endregion Protected Properties
#region Protected Methods
@@ -210,18 +184,56 @@ namespace GWMS.UI.Components
#endregion Protected Methods
#region Public Methods
#region Private Properties
public string getPressData(string valore, string formato)
[Inject]
private IConfiguration Configuration { get; set; }
[Inject]
private NavigationManager NavManager { get; set; }
private List<PlantLevSumDTO>? PlantLevelDto { get; set; } = null;
private int SelPlantId
{
string answ = "";
if (currItem.PressAct.ContainsKey(valore))
get
{
answ = currItem.PressAct[valore].ToString(formato);
int answ = 0;
if (AppMService.Order_Filter != null)
{
answ = AppMService.Order_Filter.PlantId;
}
return answ;
}
set
{
if (!AppMService.Order_Filter.PlantId.Equals(value))
{
AppMService.Order_Filter.PlantId = value;
}
}
return answ;
}
#endregion Public Methods
#endregion Private Properties
#region Private Methods
private void fixRedFactor()
{
int answ = 1;
int numCount = _currItem.LevelTS.Count;
// passo a 2h se > 3 gg
if (numCount > 240)
answ = 5;
// passo a 3h se > 5 gg
else if (numCount > 120)
answ = 4;
// passo a 4h se > 10 gg
else if (numCount > 72)
answ = 3;
redFact = answ;
}
#endregion Private Methods
}
}
+4 -1
View File
@@ -14,6 +14,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static GWMS.Data.IobObjects;
@@ -475,12 +476,14 @@ namespace GWMS.UI.Data
{
await distributedCache.RemoveAsync("DATA:CONFIG");
await distributedCache.RemoveAsync("DATA:CHECKLEVEL");
await distributedCache.RemoveAsync("DATA:PLANTS:LevelSum");
await distributedCache.RemoveAsync("DATA:PLANTS:ListDTO");
await distributedCache.RemoveAsync("DATA:PLANTS:VetoReadDto");
await distributedCache.RemoveAsync("DATA:SUPPL:List");
await distributedCache.RemoveAsync("DATA:TRANSP:List");
await distributedCache.RemoveAsync("DATA:WEEKPLAN:List");
await distributedCache.RemoveAsync("ParamSend:List");
await distributedCache.RemoveAsync("DATA:*");
}
public async Task<List<GWMS.Data.DatabaseModels.ItemModel>> ItemsGetAll()
@@ -1096,7 +1099,7 @@ namespace GWMS.UI.Data
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.GetPlantLogSummary(CurrFilter.PlantId, CurrFilter.DateStart, CurrFilter.DateEnd);
dbResult = dbController.GetPlantLevSumDto(CurrFilter.PlantId, CurrFilter.DateStart, CurrFilter.DateEnd);
rawData = JsonConvert.SerializeObject(dbResult);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(true));
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.0.2406.0509</Version>
<Version>1.0.2406.0516</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
+13 -11
View File
@@ -146,7 +146,7 @@ namespace GWMS.UI.Pages
[Inject]
protected GWMSDataService DataService { get; set; }
protected DateTime DateEnd
private DateTime DateEnd
{
get
{
@@ -168,7 +168,7 @@ namespace GWMS.UI.Pages
}
}
protected DateTime DateStart
private DateTime DateStart
{
get
{
@@ -251,6 +251,7 @@ namespace GWMS.UI.Pages
}
}
#if false
private void OnDateEndChanged(DateTime? date)
{
DateEnd = (DateTime)date;
@@ -259,7 +260,8 @@ namespace GWMS.UI.Pages
private void OnDateStartChanged(DateTime? date)
{
DateStart = (DateTime)date;
}
}
#endif
private async Task ReloadData()
{
@@ -292,6 +294,8 @@ namespace GWMS.UI.Pages
if (currPlant != null && currSuppl != null)
{
DateTime ordDate = currItem.DataRif.AddDays(-1);
// calcolo il delta crescita come il delta min * num ore durata fillup...
var minIncr = currItem.DeltaMin * (currItem.FillEnd.Subtract(currItem.FillStart).TotalHours);
// creo un nuovo record
currRecord = new OrderModel()
{
@@ -301,15 +305,13 @@ namespace GWMS.UI.Pages
OrderDesc = $"Ord Man {currPlant.PlantDesc} - {ordDate}",
TransporterId = 1,
OrderCode = $"O{currPlant.PlantCode}{ordDate:yyMMddHHmm}",
LevelStart = Math.Round(currItem.LevelMin),
LevelEnd = Math.Round(currItem.LevelMax),
DtExecStart = currItem.FillStart,
DtExecEnd = currItem.FillEnd,
ExecutionQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / currItem.DeltaMin) * currItem.DeltaMin,
OrderQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin) / 2000) * 2000
LevelStart = Math.Floor(currItem.LevelMin),
LevelEnd = Math.Ceiling(currItem.LevelMax),
DtExecStart = currItem.FillStart.AddMinutes(-1),
DtExecEnd = currItem.FillEnd.AddMinutes(1),
ExecutionQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin + minIncr) / currItem.DeltaMin) * currItem.DeltaMin,
OrderQty = Math.Ceiling((currItem.LevelMax - currItem.LevelMin + minIncr) / 2000) * 2000
};
//// aggiorno filtro
//AppMService.Order_Filter = SelectOrderData.Init(5, 10);
}
}
+5 -5
View File
@@ -1,7 +1,7 @@
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<link rel="apple-touch-icon" sizes="180x180" href="~/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="~/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="~/favicon-16x16.png">
<link rel="manifest" href="~/site.webmanifest">
<link rel="mask-icon" href="~/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
+3
View File
@@ -43,6 +43,9 @@ namespace GWMS.UI
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// aggiunt base URL x routing corretto
app.UsePathBase(Configuration["RuntimeOpt:BaseAppPath"]);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
+4 -2
View File
@@ -19,8 +19,10 @@
"sKey": "M3T@n0"
},
"ZCodeUrl": "https://qrcode.steamware.net/",
"BaseUrl": "https://gwms.egalware.com/",
"BaseAppPath": "/pizzaferri/",
"RuntimeOpt": {
"BaseUrl": "https://gwms.egalware.com",
"BaseAppPath": "/pizzaferri"
},
"QrRedirPage": "pizzaferri/",
"jumpRedir": "~/../"
}
+4 -2
View File
@@ -7,6 +7,8 @@
}
},
"ZCodeUrl": "https://qrcode.steamware.net/",
"BaseUrl": "https://corelocal.egalware.com/",
"BaseAppPath": "/pizzaferri/"
"RuntimeOpt": {
"BaseUrl": "https://corelocal.egalware.com",
"BaseAppPath": "/pizzaferri"
}
}
+5 -3
View File
@@ -29,13 +29,15 @@
"MaxLogRecord": 360,
"ZCodeUrl": "https://qrcode.steamware.net/",
"ChartWaitDelay": 10,
"BaseUrl": "https://localhost:44339/",
"BaseAppPath": "",
"QrRedirPage": "",
"jumpRedir": "~/../../",
"logo": "img/LogoPizzaferri.jpg",
"ReloadParamTimer": 15000,
"ReloadStatusTimer": 30000,
"ReloadStatusTimer": 20000,
"RuntimeOpt": {
"BaseUrl": "https://localhost:44339",
"BaseAppPath": "/pizzaferri"
},
"ExternalProviders": {
"MailKit": {
"SMTP": {
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GWMS - Gas Warehouse Management System</i>
<h4>Versione: 1.0.2406.0509</h4>
<h4>Versione: 1.0.2406.0516</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.0.2406.0509
1.0.2406.0516
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2406.0509</version>
<version>1.0.2406.0516</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>