Compare commits

..

4 Commits

Author SHA1 Message Date
Samuele Locatelli 86bd0f375c Merge branch 'release/RC7' 2021-08-30 12:39:06 +02:00
Samuele Locatelli 9e1d437563 Aggiunta indicazione trasmisisone RTime / vecchia 2021-08-30 12:38:20 +02:00
Samuele Locatelli 6bd54468dd Modifica logging (meno verboso) e rallentamento check UI 2021-08-30 12:13:27 +02:00
Samuele Locatelli 52a71d236d Merge tag 'RC6' into develop
Inserite trappole x log + verboso
2021-08-30 11:58:51 +02:00
13 changed files with 82 additions and 53 deletions
+6 -2
View File
@@ -26,7 +26,7 @@ namespace GWMS.Data.Controllers
{
_configuration = configuration;
dbCtx = new GWMSContext(configuration);
Log.Info("Avviata classe GWMSController");
//Log.Info("Avviata classe GWMSController");
}
#endregion Public Constructors
@@ -50,7 +50,7 @@ namespace GWMS.Data.Controllers
{
// Clear database context
dbCtx.Dispose();
Log.Info("Dispose di GWMSController");
//Log.Info("Dispose di GWMSController");
}
public List<ConfigModel> GetConfig()
@@ -346,6 +346,7 @@ namespace GWMS.Data.Controllers
/// <returns></returns>
public PlantDTO PlantDTO(int PlantId, int maxRecords)
{
DateTime lastRec = DateTime.Today;
var currPlant = GetPlant(PlantId);
PlantDTO answ = new PlantDTO();
List<TSData> LevelTS = new List<TSData>();
@@ -423,6 +424,8 @@ namespace GWMS.Data.Controllers
double valBH = PressBHTS.Count > 0 ? PressBHTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0;
double valBL = PressBLTS.Count > 0 ? PressBLTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().ValDouble : 0;
lastRec = LevelTS.Count > 0 ? LevelTS.OrderByDescending(x => x.DtEvent).Take(1).FirstOrDefault().DtEvent : DateTime.Today;
PressAct.Add("Main", valMain);
PressAct.Add("BH", valBH);
PressAct.Add("BL", valBL);
@@ -430,6 +433,7 @@ namespace GWMS.Data.Controllers
// popolo valolri
answ = new PlantDTO()
{
LastUpdate = lastRec,
PlantId = PlantId,
PlantCode = currPlant.PlantCode,
PlantDesc = currPlant.PlantDesc,
+2
View File
@@ -18,6 +18,8 @@ namespace GWMS.Data.DTO
public string PlantCode { get; set; } = "";
public string PlantDesc { get; set; } = "";
public DateTime LastUpdate { get; set; } = DateTime.Today;
public double LevelMax { get; set; } = 99999;
public double LevelAct { get; set; } = 0;
+11 -5
View File
@@ -9,7 +9,7 @@
<div class="col-5 pr-0 font-weight-bold">
<h2>@currItem.PlantCode</h2>
</div>
<div class="col-7 text-right">
<div class="col-7 text-right align-bottom">
<h4>@currItem.PlantDesc</h4>
</div>
</div>
@@ -46,12 +46,18 @@
<div class="row">
<div class="col-12">
<ul class="list-group">
<li class="list-group-item active d-flex justify-content-between align-items-center">SERBATOIO Principale</li>
<li class="list-group-item @headerStatus d-flex justify-content-between align-items-center px-0 py-1 small">
<div class="px-1" title="@checkRTime">
SERBATOIO Principale <i class="fas fa-play @playStatus"></i>
</div>
<div class="px-1 text-right">
<span><i class="fas fa-database"></i> Livello:</span><span>@currItem.LevelAct.ToString("N0")/@currItem.LevelMax.ToString("N0")</span> | <span style="font-size:1.2em;"><b>@currItem.LevelRatio</b> <sub>%</sub></span>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="row">
<div class="col-12 text-center small">
<span><i class="fas fa-database"></i> Livello: </span> <span style="font-size:1.2em;"><b>@currItem.LevelRatio</b> <sub>%</sub></span> <span>(@currItem.LevelAct.ToString("N0")/@currItem.LevelMax.ToString("N0"))</span>
</div>
@*<div class="col-12 text-center small">
</div>*@
<div class="col-12 small">
<Progress>
<ProgressBar Value="@currItem.LevelRatio" Striped="false" Animated="false" />
+15
View File
@@ -116,6 +116,11 @@ namespace GWMS.UI.Components
#region Public Properties
public string checkRTime
{
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? $"Ultimo aggiornamento: {_currItem.LastUpdate}" : "Dati Realtime";
}
[Parameter]
public PlantDTO currItem
{
@@ -140,6 +145,16 @@ namespace GWMS.UI.Components
}
}
public string headerStatus
{
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? "text-secondary" : "active";
}
public string playStatus
{
get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? "text-danger" : "text-success";
}
#endregion Public Properties
#region Private Methods
+34 -34
View File
@@ -42,7 +42,7 @@ namespace GWMS.UI.Controllers
public IOBController(GWMSDataService DataService)
{
_DataService = DataService;
Log.Debug("Avviata classe IOBController");
//Log.Debug("Avviata classe IOBController");
}
#endregion Public Constructors
@@ -67,7 +67,7 @@ namespace GWMS.UI.Controllers
[HttpGet("addOptPar/{id}")]
public string addOptPar(string id, string pName, string pValue)
{
Log.Debug($"Chiamata addOptPar | {id} | {pName} | {pValue}");
//Log.Debug($"Chiamata addOptPar | {id} | {pName} | {pValue}");
return $"N.A. | {id} | {pName} | {pValue}";
}
@@ -87,7 +87,7 @@ namespace GWMS.UI.Controllers
[HttpGet("addTask2Exe/{id}")]
public string addTask2Exe(string id, string taskName, string taskVal)
{
Log.Debug($"Chiamata addTask2Exe | {id} | {taskName} | {taskVal}");
//Log.Debug($"Chiamata addTask2Exe | {id} | {taskName} | {taskVal}");
return $"N.A. | {id} | {taskName} | {taskVal}";
}
@@ -100,7 +100,7 @@ namespace GWMS.UI.Controllers
[HttpGet("alive")]
public string alive()
{
Log.Debug("Chiamata alive");
//Log.Debug("Chiamata alive");
return $"OK";
}
@@ -114,7 +114,7 @@ namespace GWMS.UI.Controllers
[HttpGet("checkLevels/{id}")]
public async Task<string> checkLevels(string id)
{
Log.Debug($"Chiamata checkLevels | {id}");
//Log.Debug($"Chiamata checkLevels | {id}");
bool fatto = false;
// ...verifica per ricalcolo ordini...
fatto = await _DataService.checkLevels();
@@ -132,7 +132,7 @@ namespace GWMS.UI.Controllers
[HttpDelete("{id}")]
public void Delete(int id)
{
Log.Debug($"Chiamata Delete | {id}");
//Log.Debug($"Chiamata Delete | {id}");
}
/// <summary>
@@ -145,7 +145,7 @@ namespace GWMS.UI.Controllers
[HttpGet("enabled/{id}")]
public async Task<string> enabled(string id)
{
Log.Debug($"Chiamata enabled | {id}");
//Log.Debug($"Chiamata enabled | {id}");
string answ = "ND";
// se id nullo --> KO!
if (id == null)
@@ -169,7 +169,7 @@ namespace GWMS.UI.Controllers
[HttpPost("evListJson/{id}")]
public string evListJson(string id, [FromBody] evJsonPayload rawData)
{
Log.Debug($"Chiamata evListJson | {id}");
//Log.Debug($"Chiamata evListJson | {id}");
string answ = "KO";
#if false
int insDone = 0;
@@ -222,7 +222,7 @@ namespace GWMS.UI.Controllers
[HttpGet("flog/{id}")]
public async Task<string> flog(string id, string flux, string valore, string dtEve, string dtCurr, string cnt)
{
Log.Debug($"Chiamata flog | {id} | {flux} | {valore} | {dtEve} | {dtCurr} | {cnt}");
//Log.Debug($"Chiamata flog | {id} | {flux} | {valore} | {dtEve} | {dtCurr} | {cnt}");
bool fatto = false;
// formato yyyymmddHHMMSSnnn ovvero da anno a millisecondi
if (cnt == null)
@@ -319,7 +319,7 @@ namespace GWMS.UI.Controllers
[HttpPost("flogJson/{id}")]
public async Task<string> flogJson(string id, [FromBody] flogJsonPayload rawData)
{
Log.Debug($"Chiamata flogJson | {id}");
//Log.Debug($"Chiamata flogJson | {id}");
bool fatto = false;
// verifico ci sia valore
if (rawData != null && !string.IsNullOrEmpty(id))
@@ -358,7 +358,7 @@ namespace GWMS.UI.Controllers
[HttpPost("forceSplitOdl/{id}")]
public string forceSplitOdl(string id)
{
Log.Debug($"Chiamata forceSplitOdl | {id}");
//Log.Debug($"Chiamata forceSplitOdl | {id}");
return "OK";
}
@@ -377,7 +377,7 @@ namespace GWMS.UI.Controllers
[HttpPost("forceSplitOdlFull/{id}")]
public string forceSplitOdlFull(string id, bool doConfirm, bool qtyFromLast, int? roundStep, string keyRichiesta = "")
{
Log.Debug($"Chiamata forceSplitOdlFull | {id}");
//Log.Debug($"Chiamata forceSplitOdlFull | {id}");
return "OK";
}
@@ -390,7 +390,7 @@ namespace GWMS.UI.Controllers
[HttpGet]
public string Get()
{
Log.Debug("Chiamata Get");
//Log.Debug("Chiamata Get");
return "OK";
}
@@ -404,7 +404,7 @@ namespace GWMS.UI.Controllers
[HttpGet("{id}")]
public string Get(int id)
{
Log.Debug($"Chiamata Get | {id}");
//Log.Debug($"Chiamata Get | {id}");
return "OK";
}
@@ -419,7 +419,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCounter/{id}")]
public string getCounter(string id)
{
Log.Debug($"Chiamata getCounter | {id}");
//Log.Debug($"Chiamata getCounter | {id}");
return "0";
}
@@ -434,7 +434,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCounterTCRec/{id}")]
public string getCounterTCRec(string id)
{
Log.Debug($"Chiamata getCounterTCRec | {id}");
//Log.Debug($"Chiamata getCounterTCRec | {id}");
return "0";
}
@@ -449,7 +449,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrData/{id}")]
public string getCurrData(string id)
{
Log.Debug($"Chiamata getCurrData | {id}");
//Log.Debug($"Chiamata getCurrData | {id}");
return $"{id}";
}
@@ -464,7 +464,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrODL/{id}")]
public string getCurrODL(string id)
{
Log.Debug($"Chiamata getCurrODL | {id}");
//Log.Debug($"Chiamata getCurrODL | {id}");
return "1";
}
@@ -477,7 +477,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrOdlRow/{id}")]
public string getCurrOdlRow(string id)
{
Log.Debug($"Chiamata getCurrOdlRow | {id}");
//Log.Debug($"Chiamata getCurrOdlRow | {id}");
return "";
}
@@ -490,7 +490,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrOdlStart/{id}")]
public string getCurrOdlStart(string id)
{
Log.Debug($"Chiamata getCurrOdlStart | {id}");
//Log.Debug($"Chiamata getCurrOdlStart | {id}");
return $"{DateTime.Now}";
}
@@ -503,7 +503,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getCurrStatoRow/{id}")]
public string getCurrStatoRow(string id)
{
Log.Debug($"Chiamata getCurrStatoRow | {id}");
//Log.Debug($"Chiamata getCurrStatoRow | {id}");
return "";
}
@@ -516,7 +516,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getFiles/{id}")]
public string getFiles(string id)
{
Log.Debug($"Chiamata getFiles | {id}");
//Log.Debug($"Chiamata getFiles | {id}");
return "";
}
@@ -529,7 +529,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getIdlePeriod/{id}")]
public int getIdlePeriod(string id)
{
Log.Debug($"Chiamata getIdlePeriod | {id}");
//Log.Debug($"Chiamata getIdlePeriod | {id}");
return 0;
}
@@ -541,7 +541,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getIob2call/{id}")]
public string getIob2call(string id)
{
Log.Debug($"Chiamata getIob2call | {id}");
//Log.Debug($"Chiamata getIob2call | {id}");
return "";
}
@@ -553,7 +553,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getM2IOB/{id}")]
public string getM2IOB(string id)
{
Log.Debug($"Chiamata getM2IOB | {id}");
//Log.Debug($"Chiamata getM2IOB | {id}");
return "";
}
@@ -566,7 +566,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getObjItems/{id}")]
public string getObjItems(string id)
{
Log.Debug($"Chiamata getObjItems | {id}");
//Log.Debug($"Chiamata getObjItems | {id}");
return "";
}
@@ -581,7 +581,7 @@ namespace GWMS.UI.Controllers
[HttpGet("getTask2Exe/{id}")]
public string getTask2Exe(string id)
{
Log.Debug($"Chiamata getTask2Exe | {id}");
//Log.Debug($"Chiamata getTask2Exe | {id}");
string answ = "";
#if false
// scrivo keep alive!!! (se necessario, altrimenti è in cache...)
@@ -613,7 +613,7 @@ namespace GWMS.UI.Controllers
[HttpGet("input/{id}")]
public string input(string id, string valore, string dtEve, string dtCurr, string cnt)
{
Log.Debug($"Chiamata input | {id} | {valore} | {dtEve} | {dtCurr} | {cnt}");
//Log.Debug($"Chiamata input | {id} | {valore} | {dtEve} | {dtCurr} | {cnt}");
string answ = "OK";
#if false
// formato yyyymmddHHMMSSnnn ovvero da anno a millisecondi
@@ -645,14 +645,14 @@ namespace GWMS.UI.Controllers
[HttpPost]
public void Post([FromBody] string value)
{
Log.Debug("Chiamata Post");
//Log.Debug("Chiamata Post");
}
// PUT api/IOB/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
Log.Debug($"Chiamata Put | {id}");
//Log.Debug($"Chiamata Put | {id}");
}
#if false
@@ -1133,7 +1133,7 @@ namespace GWMS.UI.Controllers
[HttpPost("saveConf/{id}")]
public string saveConf(string id, [FromBody] System.Text.Json.JsonElement rawQuery)
{
Log.Debug($"Chiamata saveConf | {id}");
//Log.Debug($"Chiamata saveConf | {id}");
// problema deserializzaizone ENUM con classe nuova dotnet 5:
// https://github.com/graphql-dotnet/graphql-dotnet/issues/1439
@@ -1172,7 +1172,7 @@ namespace GWMS.UI.Controllers
[HttpGet("sendReboot")]
public string sendReboot(string idxMacchina, string mac)
{
Log.Debug($"Chiamata sendReboot | {idxMacchina} | {mac}");
//Log.Debug($"Chiamata sendReboot | {idxMacchina} | {mac}");
string answ = "";
try
{
@@ -1200,7 +1200,7 @@ namespace GWMS.UI.Controllers
[HttpPost("setObjItems/{id}")]
public string setObjItems(string id, [FromBody] List<objItem> currParams)
{
Log.Debug($"Chiamata setObjItems | {id}");
//Log.Debug($"Chiamata setObjItems | {id}");
string answ = "";
if (string.IsNullOrWhiteSpace(id))
{
@@ -1230,7 +1230,7 @@ namespace GWMS.UI.Controllers
[HttpPost("uploadFile/{id}")]
public string uploadFile(string id)
{
Log.Debug($"Chiamata uploadFile | {id}");
//Log.Debug($"Chiamata uploadFile | {id}");
string answ = "";
#if false
// questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo...
+5 -5
View File
@@ -47,14 +47,14 @@ namespace GWMS.UI.Controllers
[HttpDelete("{id}")]
public void Delete(int id)
{
Log.Debug($"Chiamata Delete | {id}");
//Log.Debug($"Chiamata Delete | {id}");
}
// GET: api/PlantData
[HttpGet]
public async Task<List<PlantDTO>> Get()
{
Log.Debug("Chiamata Get");
//Log.Debug("Chiamata Get");
// serializzo i dati di PlantDTO dell'impianto richiesto
List<PlantDTO> ListRecords = await _DataService.PlantsGetAll();
return ListRecords;
@@ -64,7 +64,7 @@ namespace GWMS.UI.Controllers
[HttpGet("{id}")]
public async Task<PlantDTO> Get(int id)
{
Log.Debug($"Chiamata Get | {id}");
//Log.Debug($"Chiamata Get | {id}");
// serializzo i dati di PlantDTO dell'impianto richiesto
var ListRecords = await _DataService.PlantsGetAll();
//seleziono plant...
@@ -76,14 +76,14 @@ namespace GWMS.UI.Controllers
[HttpPost]
public void Post([FromBody] string value)
{
Log.Debug("Chiamata Post");
//Log.Debug("Chiamata Post");
}
// PUT api/PlantData/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
Log.Debug($"Chiamata Put | {id}");
//Log.Debug($"Chiamata Put | {id}");
}
#endregion Public Methods
+1 -1
View File
@@ -54,7 +54,7 @@ namespace GWMS.UI.Controllers
[HttpGet]
public async Task<List<PlantLogModel>> Get()
{
Log.Debug("Chiamata Get");
//Log.Debug("Chiamata Get");
// arrotondo ai 5 minuti
DateTime adesso = DateTime.Now;
int dayHour = adesso.Hour;
+2
View File
@@ -97,6 +97,7 @@ namespace GWMS.UI.Data
/// <param name="newItems"></param>
private async Task updateCurrDTO(List<PlantLogModel> newItems)
{
DateTime adesso = DateTime.Now;
List<PlantDTO> dbResult = new List<PlantDTO>();
int PlantId = newItems.FirstOrDefault().PlantId;
string cacheKey = "DATA:PLANTS:ListDTO";
@@ -121,6 +122,7 @@ namespace GWMS.UI.Data
if (lastLev != null)
{
currDto.LevelAct = lastLev.ValNumber;
currDto.LastUpdate = adesso;
}
// verifico SE c'è MainPress
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>1.0.2108.3011</Version>
<Version>1.0.2108.3012</Version>
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
+2 -2
View File
@@ -154,8 +154,8 @@ namespace GWMS.UI
.AddHealthChecksUI(s =>
{
s.AddHealthCheckEndpoint("GWMS_Services", "health");
s.SetEvaluationTimeInSeconds(15);
s.SetMinimumSecondsBetweenFailureNotifications(60);
s.SetEvaluationTimeInSeconds(60);
s.SetMinimumSecondsBetweenFailureNotifications(120);
s.SetApiMaxActiveRequests(5);
s.SetHeaderText("GWMS Health Check Status");
})
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GWMS - Gas Warehouse Management System</i>
<h4>Versione: 1.0.2108.3011</h4>
<h4>Versione: 1.0.2108.3012</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.0.2108.3011
1.0.2108.3012
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2108.3011</version>
<version>1.0.2108.3012</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>