Update display STATS x situazione acquisitori + update conf MON/TAB3 x MP.Data in json conf

This commit is contained in:
Samuele Locatelli
2026-05-04 12:36:09 +02:00
parent a75cb19ea7
commit 8b02b0da12
17 changed files with 257 additions and 45 deletions
+94
View File
@@ -0,0 +1,94 @@
# CI to Local Workflow Guide
This document describes how the GitLab CI pipeline in this repository translates to local commands that can be run on your machine. It also contains helper scripts and environment variables used by the CI.
## Environment Variables
All variables listed below are interpolated in the CI templates. When running locally you can set them in a PowerShell profile or via `dotnet` arguments.
| Variable | Description | Typical value |
|----------|--------------|---------------|
| `SOL_NAME` | Solution name to restore | **MP-STATS.sln** |
| `PROJ_PATH` | Directory containing the main project | **MP.Stats** |
| `APP_NAME` | Main project file name (without `.csproj`) | **MP.Stats** |
| `NUGET_PATH` | NuGet credential file | **`C:\\Users\\samuele.steamw\AppData\Roaming\NuGet\Credentials.config`** |
| `NEXUS_PATH` | Nexus host URL | **https://nexus.steamware.net** |
| `DEST` | Artifacts output folder | **bin\publish** |
| `VERS_MAIN`, `VERS_MAIN_APP`, `VERSSUB` | Version strings used in packaging | **1.0.0** /
| `NEXUS_PASSWD` | Nexus password (secure via CI secret) | *Secret* |
## Build Pipeline (`buildjob`) Local Equivalent
The CI first restores NuGet packages and then builds the solution for the selected `APP_NAME`.
```powershell
# 1. Restore
#$env:SOL_NAME.sln is resolved by the .nuget-fix script
# In PowerShell: dotnet restore "MP-STATS.sln"
# 2. Build
# $env:APP_NAME/$env:APP_NAME.csproj points to the project file
# In PowerShell: dotnet build "MP.Stats/MP.Stats.csproj"
```
### Helper: `.nuget-fix`
The `.nuget-fix` PowerShell script removes any stale NuGet sources that conflict with the Nexus proxy and readds the latest proxy source with credentials. Ensure this script runs *before* `dotnet restore`.
## Deploy Pipeline (`deployjob`) Local Equivalent
Deployment in CI rebuilds the project, publishes it, hashes the output, and uploads it to Nexus. The same steps can be executed locally.
```powershell
# 1. Rebuild (same as Build)
# dotnet build "MP.Stats/MP.Stats.csproj"
# 2. Publish to a local folder
# The `dotnet publish` command mimics the CI publish step. The `-c Release` ensures a Release build.
# In PowerShell:
# dotnet publish "MP.Stats/MP.Stats.csproj" -c Release -o publish
# 3. Create hashes (MD5 & SHA1)
# The .hashBuild template generates .md5 and .sha1 files alongside the ZIP. A simple replacement can be
# 1. Zip the folder: `Compress-Archive -Path publish -DestinationPath $(APP_NAME).zip`
# 2. Generate hashes:
# (Get-FileHash -Algorithm MD5 "$(APP_NAME).zip").Hash | Out-File "$(APP_NAME).md5"
# (Get-FileHash -Algorithm SHA1 "$(APP_NAME).zip").Hash | Out-File "$(APP_NAME).sha1"
# 4. Upload to Nexus (requires `curl`)
# Example curl command (CI uses `nexus-curl` script):
# $curl -u $(NUGET_USER):$(NEXUS_PASSWD) "$(NEXUS_PATH)/repository/$(APP_NAME)" -T "$(APP_NAME).zip"
```
## Installer & Release
The **installer** template copies the published artifacts to a staging folder and optionally creates installers. The **release** template bumps version numbers, updates the `nuspec`, generates a changelog, and pushes the packages to Nexus.
Generally these steps are CIonly, but you can repeat the same `dotnet pack` / `nuget push` commands locally if needed.
## Common Issues & Fixes
* _NuGet authentication errors_: Run `.nuget-fix` to reset the sources.
* _Missing SDK_: Verify `dotnet --list-sdks` includes at least one SDK.
* _Hashes not matching_: Ensure the ZIP file is identical to the one CI produced (same path, no hidden files).
## Quick Start
```powershell
# Restore
.\.nuget-fix
# Build
dotnet restore "MP-STATS.sln"
dotnet build "MP.Stats/MP.Stats.csproj"
# Publish & run
dotnet publish "MP.Stats/MP.Stats.csproj" -c Release -o publish
dotnet run --project "MP.Stats/MP.Stats.csproj"
# For hotreload during development
dotnet watch run --project "MP.Stats/MP.Stats.csproj"
```
---
Feel free to adjust paths or environment variable names if your local setup differs.
+2 -3
View File
@@ -7,8 +7,8 @@
<PackageVersion Include="Blazored.LocalStorage" Version="4.5.0" />
<PackageVersion Include="Blazored.SessionStorage" Version="2.4.0" />
<PackageVersion Include="DiffMatchPatch" Version="1.0.3" />
<PackageVersion Include="EgwCoreLib.Razor" Version="1.5.2511.312" />
<PackageVersion Include="EgwCoreLib.Utils" Version="1.5.2511.312" />
<PackageVersion Include="EgwCoreLib.Razor" Version="1.5.2605.412" />
<PackageVersion Include="EgwCoreLib.Utils" Version="1.5.2605.412" />
<PackageVersion Include="MailKit" Version="4.16.0" />
<PackageVersion Include="Majorsoft.Blazor.Components.Debounce" Version="1.5.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="8.0.25" />
@@ -48,6 +48,5 @@
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.9.0" />
<PackageVersion Include="YamlDotNet" Version="16.1.0" />
<PackageVersion Include="Yarp.ReverseProxy" Version="2.3.0" />
</ItemGroup>
</Project>
+2 -2
View File
@@ -201,9 +201,9 @@ namespace MP.Data.Controllers
/// Elenco controllo stato Macchine Energy x check
/// </summary>
/// <returns></returns>
public async Task<List<MacchineEnergyCheckModel>> MacchineEnergyCheckGetAllAsync()
public async Task<List<MaccEnergyCheckModel>> MacchineEnergyCheckGetAllAsync()
{
List<MacchineEnergyCheckModel> dbResult = new List<MacchineEnergyCheckModel>();
List<MaccEnergyCheckModel> dbResult = new List<MaccEnergyCheckModel>();
using (var dbCtx = new MoonPro_STATSContext(_configuration))
{
dbResult = await dbCtx
@@ -1,16 +1,14 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace MP.Data.DbModels.Energy
{
public class MacchineEnergyCheckModel
public class MaccEnergyCheckModel
{
public string IdxMacchina { get; set; } = "";
/// <summary>
/// Nome macchina
/// </summary>
[MaxLength(50)]
public string Nome { get; set; } = "";
/// <summary>
/// Descrizione macchina
+3 -3
View File
@@ -44,7 +44,7 @@ namespace MP.Data
public virtual DbSet<DdbTurni> DbSetDdbTurni { get; set; }
public virtual DbSet<FLModel> DbSetFL { get; set; }
public virtual DbSet<MacchineModel> DbSetMacchine { get; set; }
public virtual DbSet<MacchineEnergyCheckModel> DbSetMacchineCheck { get; set; }
public virtual DbSet<MaccEnergyCheckModel> DbSetMacchineCheck { get; set; }
public virtual DbSet<StatsODL> DbSetODL { get; set; }
public virtual DbSet<OdlEnergyModel> DbSetOdlEnergy { get; set; }
@@ -139,11 +139,11 @@ namespace MP.Data
.HasMaxLength(5);
});
modelBuilder.Entity<MacchineEnergyCheckModel>(entity =>
modelBuilder.Entity<MaccEnergyCheckModel>(entity =>
{
entity.HasNoKey();
entity.ToView("v_UI_MacchineEnergyCheck");
entity.ToView("v_UI_MaccEnergyCheck");
});
modelBuilder.Entity<StatsAnagArticoli>(entity =>
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>MP.Land</RootNamespace>
<Version>8.16.2604.2718</Version>
<Version>8.16.2605.0411</Version>
<Configurations>Debug;Release;Debug_LiManDebug</Configurations>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<RunAnalyzersDuringBuild>True</RunAnalyzersDuringBuild>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo Tablet MAPO - DotNet6</i>
<h4>Versione: 8.16.2604.2718</h4>
<h4>Versione: 8.16.2605.0411</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
8.16.2604.2718
8.16.2605.0411
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2604.2718</version>
<version>8.16.2605.0411</version>
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+6 -6
View File
@@ -378,20 +378,20 @@ namespace MP.Stats.Data
/// Elenco check stato Macchine Energy
/// </summary>
/// <returns></returns>
public async Task<List<MacchineEnergyCheckModel>> MacchineEnergyCheckGetAll()
public async Task<List<MaccEnergyCheckModel>> MacchineEnergyCheckGetAll()
{
// setup parametri costanti
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<MacchineEnergyCheckModel> result = new List<MacchineEnergyCheckModel>();
List<MaccEnergyCheckModel> result = new List<MaccEnergyCheckModel>();
// cerco in redis...
DateTime adesso = DateTime.Now;
string currKey = $"{redisBaseKey}:Cache:MacchineEnegyCheck";
RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
if (rawData.HasValue && rawData.Length() > 2)
{
result = JsonConvert.DeserializeObject<List<MacchineEnergyCheckModel>>($"{rawData}");
result = JsonConvert.DeserializeObject<List<MaccEnergyCheckModel>>($"{rawData}");
source = "REDIS";
}
else
@@ -399,11 +399,11 @@ namespace MP.Stats.Data
result = await dbController.MacchineEnergyCheckGetAllAsync();
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await _redisDb.StringSetAsync(currKey, rawData, FastCache);
await _redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromSeconds(60));
}
if (result == null)
{
result = new List<MacchineEnergyCheckModel>();
result = new List<MaccEnergyCheckModel>();
}
sw.Stop();
Log.Debug($"MacchineEnergyCheckGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+2 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>8.16.2605.0409</Version>
<Version>8.16.2605.0412</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
@@ -50,6 +50,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EgwCoreLib.Razor" />
<PackageReference Include="Microsoft.AspNetCore.Components" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NLog.Web.AspNetCore" />
+12 -9
View File
@@ -4,12 +4,15 @@
<div class="card">
<div class="card-header table-primary p-1 d-flex justify-content-between">
<div class="px-0">
<b class="fs-4">Status Checks</b>
<b class="fs-4">Status Checks</b>
</div>
<div class="px-0 w-50">
<ParetoProgress ParetoData="@ParetoTime" Title="Situazione Acquisitori" />
</div>
<div class="px-0">
<div class="input-group">
<span class="input-group-text">Scdenza (minuti)</span>
<input type="number" class="form-control" @bind="@timeoutMin">
<span class="input-group-text">Scadenza (minuti)</span>
<input type="number" class="form-control" @bind="@timeoutMin" @bind:after="UpdateTable">
</div>
</div>
</div>
@@ -17,12 +20,12 @@
<table class="table table-sm table-striped">
<thead>
<tr>
<th class="text-start">Idx</th>
<th class="text-start">Macchina</th>
<th class="text-start">descr</th>
<th class="text-start">Flux</th>
<th class="text-end">Last Event</th>
<th class="text-end">Valore</th>
<th class="text-start">Idx <Sorter ParamName="IdxMacc" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th class="text-start">Macchina <Sorter ParamName="Nome" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th class="text-start">descr <Sorter ParamName="Descr" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th class="text-start">Flux <Sorter ParamName="CodFlux" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th class="text-end">Last Event <Sorter ParamName="dtEvento" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th class="text-end">Valore <Sorter ParamName="Valore" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
<th></th>
</tr>
</thead>
+125 -8
View File
@@ -1,3 +1,4 @@
using EgwCoreLib.Razor;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;
using MP.Data.DbModels.Energy;
@@ -25,6 +26,7 @@ namespace MP.Stats.Pages
protected override void OnInitialized()
{
sortField = "dtEvento";
timeoutMin = ConfMan.GetValue<int>("SpecialConf:TimeoutEnergyFlux");
}
@@ -38,9 +40,10 @@ namespace MP.Stats.Pages
#region Private Fields
private List<MacchineEnergyCheckModel> AllRecord = new();
private List<MaccEnergyCheckModel> AllRecord = new();
private List<MaccEnergyCheckModel> SortRecord = new();
private List<MacchineEnergyCheckModel> ListPaged = new();
private List<MaccEnergyCheckModel> ListPaged = new();
private int numRecPage = 10;
@@ -58,11 +61,11 @@ namespace MP.Stats.Pages
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
private string CheckScadute(MacchineEnergyCheckModel item)
private string CheckScadute(MaccEnergyCheckModel item)
{
DateTime adesso = DateTime.Now;
var dataAge = adesso.Subtract(item.dtEvento).TotalMinutes;
string status = "";
string status = "table-success";
// se supero limite
if (dataAge >= timeoutMin)
{
@@ -83,6 +86,18 @@ namespace MP.Stats.Pages
numRecPage = newNum;
UpdateTable();
}
protected void SortRequested(Sorter.SortCallBack e)
{
if (sortField == e.ParamName)
{
sortAsc = e.IsAscending;
}
sortField = e.ParamName;
UpdateTable();
}
private bool sortAsc = true;
private string sortField = "";
private void SavePage(int newNum)
{
@@ -92,17 +107,119 @@ namespace MP.Stats.Pages
private void UpdateTable()
{
// esegue paginazione
if (totalCount > numRecPage)
// se ho ordinamento riordino...
if (!string.IsNullOrEmpty(sortField))
{
ListPaged = AllRecord.Skip((pageNum - 1) * numRecPage).Take(numRecPage).ToList();
switch (sortField)
{
case "IdxMacc":
if (sortAsc)
{
SortRecord = AllRecord.OrderBy(x => x.IdxMacchina).ToList();
}
else
{
SortRecord = AllRecord.OrderByDescending(x => x.IdxMacchina).ToList();
}
break;
case "Nome":
if (sortAsc)
{
SortRecord = AllRecord.OrderBy(x => x.Nome).ToList();
}
else
{
SortRecord = AllRecord.OrderByDescending(x => x.Nome).ToList();
}
break;
case "CodFlux":
if (sortAsc)
{
SortRecord = AllRecord.OrderBy(x => x.CodFlux).ToList();
}
else
{
SortRecord = AllRecord.OrderByDescending(x => x.CodFlux).ToList();
}
break;
case "Descr":
if (sortAsc)
{
SortRecord = AllRecord.OrderBy(x => x.Descrizione).ToList();
}
else
{
SortRecord = AllRecord.OrderByDescending(x => x.Descrizione).ToList();
}
break;
case "dtEvento":
if (sortAsc)
{
SortRecord = AllRecord.OrderBy(x => x.dtEvento).ToList();
}
else
{
SortRecord = AllRecord.OrderByDescending(x => x.dtEvento).ToList();
}
break;
case "Valore":
if (sortAsc)
{
SortRecord = AllRecord.OrderBy(x => x.Valore).ToList();
}
else
{
SortRecord = AllRecord.OrderByDescending(x => x.Valore).ToList();
}
break;
default:
SortRecord = AllRecord.OrderBy(x => x.IdxMacchina).ToList();
break;
}
}
else
{
ListPaged = AllRecord;
SortRecord = AllRecord.OrderBy(x => x.IdxMacchina).ToList();
}
// esegue paginazione
if (totalCount > numRecPage)
{
ListPaged = SortRecord.Skip((pageNum - 1) * numRecPage).Take(numRecPage).ToList();
}
else
{
ListPaged = SortRecord;
}
// calcolo pareto x scadenze...
DateTime adesso = DateTime.Now;
ParetoTime = AllRecord
.GroupBy(x =>
{
double dataAge = (adesso - x.dtEvento).TotalMinutes;
return dataAge < timeoutMin ? "success" : dataAge < timeoutMin * 2 ? "warning" : "danger";
})
.ToDictionary(g => g.Key, g => g.Count());
// Fallback per le categorie con 0 elementi (opzionale ma consigliato)
ParetoTime["success"] = ParetoTime.GetValueOrDefault("success", 0);
ParetoTime["warning"] = ParetoTime.GetValueOrDefault("warning", 0);
ParetoTime["danger"] = ParetoTime.GetValueOrDefault("danger", 0);
}
/// <summary>
/// Pareto dei tempi secondo scadenza
/// </summary>
private Dictionary<string, int> ParetoTime = new();
#endregion Private Methods
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 8.16.2605.0409</h4>
<h4>Versione: 8.16.2605.0412</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
8.16.2605.0409
8.16.2605.0412
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2605.0409</version>
<version>8.16.2605.0412</version>
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+3 -3
View File
@@ -1,4 +1,5 @@
@using System.Net.Http
@using EgwCoreLib.Razor
@using System.Net.Http
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Forms
@@ -11,5 +12,4 @@
@using MP.Stats.Components
@using MP.Stats.Components.ChartJs
@using MP.TaskMan
@using MP.TaskMan.Models
@using EgwCoreLib.Razor
@using MP.TaskMan.Models