diff --git a/GWMS.Data/Controllers/GWMSController.cs b/GWMS.Data/Controllers/GWMSController.cs index 3d0f8e0..5aad260 100644 --- a/GWMS.Data/Controllers/GWMSController.cs +++ b/GWMS.Data/Controllers/GWMSController.cs @@ -261,7 +261,7 @@ namespace GWMS.Data.Controllers /// data inizio /// data fine /// - public List GetPlantLogSummary(int PlantId, DateTime DtStart, DateTime DtEnd) + public List GetPlantLevSumDto(int PlantId, DateTime DtStart, DateTime DtEnd) { List dbResult = new List(); if (PlantId > 0) diff --git a/GWMS.UI/Components/CmpFooter.razor b/GWMS.UI/Components/CmpFooter.razor index e98158b..3c67a77 100644 --- a/GWMS.UI/Components/CmpFooter.razor +++ b/GWMS.UI/Components/CmpFooter.razor @@ -8,9 +8,3 @@ -@code { - protected DateTime adesso = DateTime.Now; - - Version version = typeof(Program).Assembly.GetName().Version; - -} \ No newline at end of file diff --git a/GWMS.UI/Components/CmpFooter.razor.cs b/GWMS.UI/Components/CmpFooter.razor.cs new file mode 100644 index 0000000..37a22c6 --- /dev/null +++ b/GWMS.UI/Components/CmpFooter.razor.cs @@ -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 + } +} \ No newline at end of file diff --git a/GWMS.UI/Components/OrderAdminEditor.razor b/GWMS.UI/Components/OrderAdminEditor.razor index ab3eb7f..be7b656 100644 --- a/GWMS.UI/Components/OrderAdminEditor.razor +++ b/GWMS.UI/Components/OrderAdminEditor.razor @@ -299,17 +299,4 @@ return q[parmName] ?? ""; } - ///// - ///// Restituisce URL immagine QRCode - ///// - ///// Parametro da renderizzare con QRCode - ///// - //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; - //} - } \ No newline at end of file diff --git a/GWMS.UI/Components/OrderSupplierEditor.razor b/GWMS.UI/Components/OrderSupplierEditor.razor index 9a83000..93e5de2 100644 --- a/GWMS.UI/Components/OrderSupplierEditor.razor +++ b/GWMS.UI/Components/OrderSupplierEditor.razor @@ -161,17 +161,4 @@ transpList = await DataService.TransportersGetAll(); } - ///// - ///// Restituisce URL immagine QRCode - ///// - ///// Parametro da renderizzare con QRCode - ///// - //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; - //} - } \ No newline at end of file diff --git a/GWMS.UI/Components/OrderTranspEditor.razor b/GWMS.UI/Components/OrderTranspEditor.razor index dc4653c..80d527d 100644 --- a/GWMS.UI/Components/OrderTranspEditor.razor +++ b/GWMS.UI/Components/OrderTranspEditor.razor @@ -114,17 +114,4 @@ transpList = await DataService.TransportersGetAll(); } - ///// - ///// Restituisce URL immagine QRCode - ///// - ///// Parametro da renderizzare con QRCode - ///// - //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; - //} - } \ No newline at end of file diff --git a/GWMS.UI/Components/PlantOverview.razor b/GWMS.UI/Components/PlantOverview.razor index 73b983a..de031fb 100644 --- a/GWMS.UI/Components/PlantOverview.razor +++ b/GWMS.UI/Components/PlantOverview.razor @@ -17,15 +17,15 @@ @*
-
-

@currItem.PlantCode

-
-
- -
-
*@ +
+

@currItem.PlantCode

+
+
+ +
+ *@ }
@@ -121,32 +121,52 @@
  • - @if (currItem.SoldTS != null && currItem.SoldTS.Count > 0 && currItem.SoldTS[0].ValDouble > 0) +
    Venduto Ieri:
    + @if (PlantLevelDto != null && PlantLevelDto.Count > 1) { -
    Venduto Ieri:
    -
    @currItem.SoldTS[0].ValDouble.ToString("N1") kg
    + @if (PlantLevelDto[1].QtaVenduta > 0) + { +
    @($"{PlantLevelDto[1].QtaVenduta:N0}") kg
    + @*
    @($"{currItem.SoldTS[0].ValDouble:N0}") kg
    *@ + } + else + { +
    ND
    +
    (@($"{PlantLevelDto[1].QtaVenduta:N0}")kg)
    + } } else { -
    Venduto Ieri:
    -
    ND kg
    + }
    - @if (currItem.SoldTS != null && currItem.SoldTS.Count > 1 && currItem.SoldTS[1].ValDouble > 0) +
    Venduto Oggi:
    + @if (PlantLevelDto != null && PlantLevelDto.Count > 0) { -
    Venduto Oggi:
    -
    @currItem.SoldTS[1].ValDouble.ToString("N1") kg
    + @if (PlantLevelDto[0].QtaVenduta > 0) + { +
    @($"{PlantLevelDto[0].QtaVenduta:N0}") kg
    + + @*
    @($"{currItem.SoldTS[1].ValDouble:N0}") kg
    *@ + } + else + { +
    ND
    +
    (@($"{PlantLevelDto[0].QtaVenduta:N0}") kg)
    + } } else { -
    Venduto Oggi:
    -
    ND kg
    + }
  • +
    + updated: @($"{DateTime.Now:HH:mm:ss}") +
    diff --git a/GWMS.UI/Components/PlantOverview.razor.cs b/GWMS.UI/Components/PlantOverview.razor.cs index 9b86afc..4dc165f 100644 --- a/GWMS.UI/Components/PlantOverview.razor.cs +++ b/GWMS.UI/Components/PlantOverview.razor.cs @@ -13,59 +13,6 @@ namespace GWMS.UI.Components { public partial class PlantOverview { - #region Protected Fields - - protected PlantDTO _currItem = new PlantDTO(); - - protected List LevelVal = new List(); - - /// - /// fattore di riduzione x visualizzare meno punti (in base alla numerosità... - /// - 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 LevelVal = new List(); + + /// + /// fattore di riduzione x visualizzare meno punti (in base alla numerosità... + /// + 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? 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 } } \ No newline at end of file diff --git a/GWMS.UI/Data/GWMSDataService.cs b/GWMS.UI/Data/GWMSDataService.cs index d9d7fc7..7ca3fd3 100644 --- a/GWMS.UI/Data/GWMSDataService.cs +++ b/GWMS.UI/Data/GWMSDataService.cs @@ -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> 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)); diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index 6341375..369c6b8 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2406.0509 + 1.0.2406.0516 95c9f021-52d1-4390-a670-5810b7b777b0 true true diff --git a/GWMS.UI/Pages/PlantAnalisys.razor.cs b/GWMS.UI/Pages/PlantAnalisys.razor.cs index 6be42bd..72adba1 100644 --- a/GWMS.UI/Pages/PlantAnalisys.razor.cs +++ b/GWMS.UI/Pages/PlantAnalisys.razor.cs @@ -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); } } diff --git a/GWMS.UI/Pages/Shared/_Favicons.cshtml b/GWMS.UI/Pages/Shared/_Favicons.cshtml index 923b67a..4c6c6ce 100644 --- a/GWMS.UI/Pages/Shared/_Favicons.cshtml +++ b/GWMS.UI/Pages/Shared/_Favicons.cshtml @@ -1,7 +1,7 @@ - - - - - + + + + + \ No newline at end of file diff --git a/GWMS.UI/Startup.cs b/GWMS.UI/Startup.cs index 4b759ee..81ba2f2 100644 --- a/GWMS.UI/Startup.cs +++ b/GWMS.UI/Startup.cs @@ -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(); diff --git a/GWMS.UI/appsettings.Production.json b/GWMS.UI/appsettings.Production.json index 92147b7..4fc34c0 100644 --- a/GWMS.UI/appsettings.Production.json +++ b/GWMS.UI/appsettings.Production.json @@ -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": "~/../" } \ No newline at end of file diff --git a/GWMS.UI/appsettings.Staging.json b/GWMS.UI/appsettings.Staging.json index 98ae7c9..cb3f8dc 100644 --- a/GWMS.UI/appsettings.Staging.json +++ b/GWMS.UI/appsettings.Staging.json @@ -7,6 +7,8 @@ } }, "ZCodeUrl": "https://qrcode.steamware.net/", - "BaseUrl": "https://corelocal.egalware.com/", - "BaseAppPath": "/pizzaferri/" + "RuntimeOpt": { + "BaseUrl": "https://corelocal.egalware.com", + "BaseAppPath": "/pizzaferri" + } } \ No newline at end of file diff --git a/GWMS.UI/appsettings.json b/GWMS.UI/appsettings.json index d18514e..1e880e8 100644 --- a/GWMS.UI/appsettings.json +++ b/GWMS.UI/appsettings.json @@ -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": { diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index b8aa3be..41ba207 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

    Versione: 1.0.2406.0509

    +

    Versione: 1.0.2406.0516


    Note di rilascio:
    • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 3a8d22d..b2c6e7d 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2406.0509 +1.0.2406.0516 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 08d2d29..bd8447b 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2406.0509 + 1.0.2406.0516 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false