Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c2fd4870c7 | |||
| b67fae281b | |||
| 22f4455356 | |||
| 8107ba51b9 | |||
| b3062b04fc | |||
| 3739225a28 | |||
| 2db1fbc8d6 |
@@ -31,112 +31,6 @@ namespace GWMS.Data.Controllers
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void CreateSimData(int numDays, int stepMin, int maxHourRate)
|
||||
{
|
||||
// disattivazione per sicurezza
|
||||
#if false
|
||||
ResetController();
|
||||
// generazione dati casuale
|
||||
Random rnd = new Random();
|
||||
foreach (var plant in GetPlants())
|
||||
{
|
||||
var currPlant = GetPlant(plant.PlantId);
|
||||
// imposto limiti e valori attuali...
|
||||
//currPlant.LevelMax = rnd.Next(24, 28) * 1000;
|
||||
int simLevel = rnd.Next(1, (int)currPlant.LevelMax);
|
||||
double simPress = (double)rnd.Next((int)(currPlant.PressMax - 50) * 10, (int)currPlant.PressMax * 10) / 10;
|
||||
double simPressH = (double)rnd.Next((int)(currPlant.PressBHMax - 70) * 10, (int)currPlant.PressBHMax * 10) / 10;
|
||||
double simPressL = (double)rnd.Next((int)(currPlant.PressBLMax - 70) * 10, (int)currPlant.PressBLMax * 10) / 10;
|
||||
currPlant.LevelAct = simLevel;
|
||||
currPlant.PressAct = simPress;
|
||||
currPlant.PressBHAct = simPressH;
|
||||
currPlant.PressBLAct = simPressL;
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
// genero random le soglie x simulare rilievi e ordini
|
||||
int soglia01 = rnd.Next((int)currPlant.LevelMax * 60 / 100, (int)currPlant.LevelMax * 75 / 100);
|
||||
int soglia02 = rnd.Next((int)currPlant.LevelMax * 5 / 100, (int)currPlant.LevelMax * 35 / 100);
|
||||
|
||||
List<PlantLogModel> LogLevels = new List<PlantLogModel>();
|
||||
List<PlantLogModel> LogPressures = new List<PlantLogModel>();
|
||||
List<OrderModel> LogOrders = new List<OrderModel>();
|
||||
|
||||
DateTime adesso = DateTime.Now;
|
||||
int lastLevel = simLevel;
|
||||
int lastOrder = 0;
|
||||
int anticipo = 0;
|
||||
double lastPress = simPress;
|
||||
double lastPressH = simPressH;
|
||||
double lastPressL = simPressL;
|
||||
// simulo numDays gg...
|
||||
for (int i = numDays * 24 * (60 / stepMin); i > 0; i--)
|
||||
{
|
||||
anticipo = i * stepMin;
|
||||
lastLevel = lastLevel - rnd.Next(0, maxHourRate / (60 / stepMin));
|
||||
// se inferiore a soglia 1 --> ordine
|
||||
if (lastLevel + lastOrder < soglia01)
|
||||
{
|
||||
lastOrder = rnd.Next((int)currPlant.LevelMax - soglia01, (int)currPlant.LevelMax - soglia02);
|
||||
LogOrders.Add(new OrderModel() { DtOrder = adesso.AddMinutes(-anticipo), OrderQty = lastOrder, PlantId = plant.PlantId, OrderCode = $"ORD{i:000000}", OrderDesc = "SIM Order", SupplierId = 1, TransporterId = 1 });
|
||||
}
|
||||
|
||||
// se inferiore a soglia 2 --> refill
|
||||
if (lastLevel < soglia02)
|
||||
{
|
||||
lastLevel += lastOrder;
|
||||
lastOrder = 0;
|
||||
}
|
||||
LogLevels.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "Level", PlantId = plant.PlantId, ValNumber = lastLevel });
|
||||
|
||||
// pressioni!
|
||||
lastPress = lastPress - (double)rnd.Next(-30, 25) / 10;
|
||||
lastPressH = lastPressH - (double)rnd.Next(-25, 20) / 10;
|
||||
lastPressL = lastPressL - (double)rnd.Next(-25, 20) / 10;
|
||||
LogPressures.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "MainPress", PlantId = plant.PlantId, ValNumber = lastPress });
|
||||
LogPressures.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "PressBH", PlantId = plant.PlantId, ValNumber = lastPressH });
|
||||
LogPressures.Add(new PlantLogModel() { DtEvent = adesso.AddMinutes(-anticipo), FluxType = "PressBL", PlantId = plant.PlantId, ValNumber = lastPressL });
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
dbCtx
|
||||
.DbSetPlantLog
|
||||
.AddRange(LogLevels);
|
||||
|
||||
dbCtx
|
||||
.DbSetPlantLog
|
||||
.AddRange(LogPressures);
|
||||
|
||||
// salvo sul DB!
|
||||
dbCtx.SaveChanges();
|
||||
Log.Info($"Effettuato inserimento {LogLevels.Count} record PlantLog");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in salvataggio PlantLog{Environment.NewLine}{exc}");
|
||||
}
|
||||
try
|
||||
{
|
||||
dbCtx
|
||||
.DbSetOrders
|
||||
.AddRange(LogOrders);
|
||||
|
||||
// salvo sul DB!
|
||||
dbCtx.SaveChanges();
|
||||
Log.Info($"Effettuato inserimento {LogOrders.Count} record Orders");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in salvataggio Orders{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -156,6 +50,7 @@ namespace GWMS.Data.Controllers
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
Log.Info("Dispose di GWMSController");
|
||||
}
|
||||
|
||||
public List<ConfigModel> GetConfig()
|
||||
@@ -609,30 +504,6 @@ namespace GWMS.Data.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rigenera intero DB se riceve ID di un plant SIM...
|
||||
/// </summary>
|
||||
/// <param name="PlantId"></param>
|
||||
public bool RegenDB(int PlantId, int numDays, int stepMin, int maxHourRate)
|
||||
{
|
||||
bool answ = false;
|
||||
var currPlant = GetPlant(PlantId);
|
||||
if (currPlant.PlantCode.StartsWith("PIZ"))
|
||||
{
|
||||
Log.Info("Inizio RegenDB");
|
||||
|
||||
DbAdmin.resetPlantLogTable();
|
||||
|
||||
ResetController();
|
||||
|
||||
CreateSimData(numDays, stepMin, maxHourRate);
|
||||
Log.Info("Dati SIM generati");
|
||||
|
||||
answ = true;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void ResetController()
|
||||
{
|
||||
dbCtx = new GWMSContext(_configuration);
|
||||
|
||||
@@ -23,35 +23,6 @@
|
||||
@_currItem.OrderCode
|
||||
@*<img src="@getImgUrl(_currItem.OrderCode)" class="img-fluid" />*@
|
||||
</div>
|
||||
@*<div class="col-12 col-lg-8 align-items-center">
|
||||
<div class="row small">
|
||||
<div class="col-12">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" style="width: 3em;">
|
||||
<span class="fas fa-truck" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<DateEdit @bind-Date="_currItem.DtETA" InputMode="DateInputMode.DateTime" class="form-control" title="ETA (previsione consegna)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" style="width: 3em;">
|
||||
<span class="fas fa-comment-alt" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<InputText id="OrderDesc" @bind-Value="_currItem.OrderDesc" class="form-control" title="Note Ordine (opzionali)" />
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text">
|
||||
Note
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>*@
|
||||
<div class="col-12 col-lg-2">
|
||||
<div class="row">
|
||||
@*<div class="col">
|
||||
|
||||
@@ -49,15 +49,9 @@
|
||||
<li class="list-group-item active d-flex justify-content-between align-items-center">SERBATOIO Principale</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<div class="row">
|
||||
@*<div class="col-4 small">
|
||||
@currItem.LevelAct.ToString("N0")
|
||||
</div>*@
|
||||
<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-4 text-right small">
|
||||
@currItem.LevelMax.ToString("N0")
|
||||
</div>*@
|
||||
<div class="col-12 small">
|
||||
<Progress>
|
||||
<ProgressBar Value="@currItem.LevelRatio" Striped="false" Animated="false" />
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
return;
|
||||
|
||||
reportProcess();
|
||||
await DataService.RegenDB(numDays, stepMin, maxHourRate);
|
||||
//await DataService.RegenDB(numDays, stepMin, maxHourRate);
|
||||
reportChange();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@@ -27,11 +28,21 @@ namespace GWMS.UI.Controllers
|
||||
[ApiController]
|
||||
public class IOBController : ControllerBase
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Classe per logging
|
||||
/// </summary>
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public IOBController(GWMSDataService DataService)
|
||||
{
|
||||
_DataService = DataService;
|
||||
Log.Debug("Avviata classe IOBController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -56,6 +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}");
|
||||
return $"N.A. | {id} | {pName} | {pValue}";
|
||||
}
|
||||
|
||||
@@ -75,6 +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}");
|
||||
return $"N.A. | {id} | {taskName} | {taskVal}";
|
||||
}
|
||||
|
||||
@@ -87,6 +100,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("alive")]
|
||||
public string alive()
|
||||
{
|
||||
Log.Debug("Chiamata alive");
|
||||
return $"OK";
|
||||
}
|
||||
|
||||
@@ -100,6 +114,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("checkLevels/{id}")]
|
||||
public async Task<string> checkLevels(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata checkLevels | {id}");
|
||||
bool fatto = false;
|
||||
// ...verifica per ricalcolo ordini...
|
||||
fatto = await _DataService.checkLevels();
|
||||
@@ -117,6 +132,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
Log.Debug($"Chiamata Delete | {id}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -129,6 +145,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("enabled/{id}")]
|
||||
public async Task<string> enabled(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata enabled | {id}");
|
||||
string answ = "ND";
|
||||
// se id nullo --> KO!
|
||||
if (id == null)
|
||||
@@ -152,6 +169,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpPost("evListJson/{id}")]
|
||||
public string evListJson(string id, [FromBody] evJsonPayload rawData)
|
||||
{
|
||||
Log.Debug($"Chiamata evListJson | {id}");
|
||||
string answ = "KO";
|
||||
#if false
|
||||
int insDone = 0;
|
||||
@@ -166,7 +184,7 @@ namespace GWMS.UI.Controllers
|
||||
{
|
||||
if (memLayer.ML.CRI("_logLevel") > 6)
|
||||
{
|
||||
logger.lg.scriviLog($"Valori letti: idxMacchina: {id} | valore: {item.valore}", tipoLog.INFO);
|
||||
logger.lg.scriviLog($"Valori letti: idxMacchina: {id} | valore: {item.valore}", tipoLog.Debug);
|
||||
}
|
||||
|
||||
// formato datetime come yyyyMMddHHmmssfff -->es: 20181223180600000
|
||||
@@ -204,6 +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}");
|
||||
bool fatto = false;
|
||||
// formato yyyymmddHHMMSSnnn ovvero da anno a millisecondi
|
||||
if (cnt == null)
|
||||
@@ -300,6 +319,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpPost("flogJson/{id}")]
|
||||
public async Task<string> flogJson(string id, [FromBody] flogJsonPayload rawData)
|
||||
{
|
||||
Log.Debug($"Chiamata flogJson | {id}");
|
||||
bool fatto = false;
|
||||
// verifico ci sia valore
|
||||
if (rawData != null && !string.IsNullOrEmpty(id))
|
||||
@@ -338,6 +358,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpPost("forceSplitOdl/{id}")]
|
||||
public string forceSplitOdl(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata forceSplitOdl | {id}");
|
||||
return "OK";
|
||||
}
|
||||
|
||||
@@ -356,6 +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}");
|
||||
return "OK";
|
||||
}
|
||||
|
||||
@@ -368,6 +390,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet]
|
||||
public string Get()
|
||||
{
|
||||
Log.Debug("Chiamata Get");
|
||||
return "OK";
|
||||
}
|
||||
|
||||
@@ -381,6 +404,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("{id}")]
|
||||
public string Get(int id)
|
||||
{
|
||||
Log.Debug($"Chiamata Get | {id}");
|
||||
return "OK";
|
||||
}
|
||||
|
||||
@@ -395,6 +419,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getCounter/{id}")]
|
||||
public string getCounter(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getCounter | {id}");
|
||||
return "0";
|
||||
}
|
||||
|
||||
@@ -409,6 +434,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getCounterTCRec/{id}")]
|
||||
public string getCounterTCRec(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getCounterTCRec | {id}");
|
||||
return "0";
|
||||
}
|
||||
|
||||
@@ -423,6 +449,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getCurrData/{id}")]
|
||||
public string getCurrData(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getCurrData | {id}");
|
||||
return $"{id}";
|
||||
}
|
||||
|
||||
@@ -437,6 +464,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getCurrODL/{id}")]
|
||||
public string getCurrODL(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getCurrODL | {id}");
|
||||
return "1";
|
||||
}
|
||||
|
||||
@@ -449,6 +477,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getCurrOdlRow/{id}")]
|
||||
public string getCurrOdlRow(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getCurrOdlRow | {id}");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -461,6 +490,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getCurrOdlStart/{id}")]
|
||||
public string getCurrOdlStart(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getCurrOdlStart | {id}");
|
||||
return $"{DateTime.Now}";
|
||||
}
|
||||
|
||||
@@ -473,6 +503,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getCurrStatoRow/{id}")]
|
||||
public string getCurrStatoRow(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getCurrStatoRow | {id}");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -485,6 +516,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getFiles/{id}")]
|
||||
public string getFiles(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getFiles | {id}");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -497,6 +529,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getIdlePeriod/{id}")]
|
||||
public int getIdlePeriod(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getIdlePeriod | {id}");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -508,6 +541,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getIob2call/{id}")]
|
||||
public string getIob2call(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getIob2call | {id}");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -519,6 +553,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getM2IOB/{id}")]
|
||||
public string getM2IOB(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getM2IOB | {id}");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -531,6 +566,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getObjItems/{id}")]
|
||||
public string getObjItems(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getObjItems | {id}");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -545,6 +581,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("getTask2Exe/{id}")]
|
||||
public string getTask2Exe(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata getTask2Exe | {id}");
|
||||
string answ = "";
|
||||
#if false
|
||||
// scrivo keep alive!!! (se necessario, altrimenti è in cache...)
|
||||
@@ -576,6 +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}");
|
||||
string answ = "OK";
|
||||
#if false
|
||||
// formato yyyymmddHHMMSSnnn ovvero da anno a millisecondi
|
||||
@@ -587,7 +625,7 @@ namespace GWMS.UI.Controllers
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
if (memLayer.ML.CRI("_logLevel") > 6)
|
||||
{
|
||||
logger.lg.scriviLog($"Valori letti: idxMacchina: {id} | valore: {valore}", tipoLog.INFO);
|
||||
logger.lg.scriviLog($"Valori letti: idxMacchina: {id} | valore: {valore}", tipoLog.Debug);
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -607,12 +645,14 @@ namespace GWMS.UI.Controllers
|
||||
[HttpPost]
|
||||
public void Post([FromBody] string value)
|
||||
{
|
||||
Log.Debug("Chiamata Post");
|
||||
}
|
||||
|
||||
// PUT api/IOB/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
Log.Debug($"Chiamata Put | {id}");
|
||||
}
|
||||
|
||||
#if false
|
||||
@@ -692,7 +732,7 @@ namespace GWMS.UI.Controllers
|
||||
if (nCall >= nCall2Log)
|
||||
{
|
||||
// loggo
|
||||
logger.lg.scriviLog(string.Format("IOB_INDEX: effettuate {0} call", nCall), tipoLog.INFO);
|
||||
logger.lg.scriviLog(string.Format("IOB_INDEX: effettuate {0} call", nCall), tipoLog.Debug);
|
||||
// resetto!
|
||||
memLayer.ML.resetRCnt(DataLayer.mHash("COUNT:pCall:IOB_INDEX"));
|
||||
}
|
||||
@@ -748,7 +788,7 @@ namespace GWMS.UI.Controllers
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
if (memLayer.ML.CRI("_logLevel") > 6)
|
||||
{
|
||||
logger.lg.scriviLog($"Valori Live:{Environment.NewLine}idxMacchina: {id}{Environment.NewLine}liveData: {liveData}", tipoLog.INFO);
|
||||
logger.lg.scriviLog($"Valori Live:{Environment.NewLine}idxMacchina: {id}{Environment.NewLine}liveData: {liveData}", tipoLog.Debug);
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -897,7 +937,7 @@ namespace GWMS.UI.Controllers
|
||||
string answ = "";
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
// salvo SEMPRE log x questo tipo di dati!
|
||||
logger.lg.scriviLog($"Salvataggio incremento contapezzi:{Environment.NewLine}idxMacchina: {id}{Environment.NewLine}pezzi: {qty}", tipoLog.INFO);
|
||||
logger.lg.scriviLog($"Salvataggio incremento contapezzi:{Environment.NewLine}idxMacchina: {id}{Environment.NewLine}pezzi: {qty}", tipoLog.Debug);
|
||||
try
|
||||
{
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
@@ -940,7 +980,7 @@ namespace GWMS.UI.Controllers
|
||||
DateTime dataOraEvento = DateTime.Now;
|
||||
if (memLayer.ML.CRI("_logLevel") > 6)
|
||||
{
|
||||
logger.lg.scriviLog($"Salvataggio counter | idxMacchina: {id}", tipoLog.INFO);
|
||||
logger.lg.scriviLog($"Salvataggio counter | idxMacchina: {id}", tipoLog.Debug);
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -1093,6 +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}");
|
||||
// problema deserializzaizone ENUM con classe nuova dotnet 5:
|
||||
// https://github.com/graphql-dotnet/graphql-dotnet/issues/1439
|
||||
|
||||
@@ -1131,6 +1172,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("sendReboot")]
|
||||
public string sendReboot(string idxMacchina, string mac)
|
||||
{
|
||||
Log.Debug($"Chiamata sendReboot | {idxMacchina} | {mac}");
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
@@ -1158,6 +1200,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpPost("setObjItems/{id}")]
|
||||
public string setObjItems(string id, [FromBody] List<objItem> currParams)
|
||||
{
|
||||
Log.Debug($"Chiamata setObjItems | {id}");
|
||||
string answ = "";
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
@@ -1187,6 +1230,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpPost("uploadFile/{id}")]
|
||||
public string uploadFile(string id)
|
||||
{
|
||||
Log.Debug($"Chiamata uploadFile | {id}");
|
||||
string answ = "";
|
||||
#if false
|
||||
// questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo...
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -15,11 +16,21 @@ namespace GWMS.UI.Controllers
|
||||
[ApiController]
|
||||
public class PlantDataController : ControllerBase
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Classe per logging
|
||||
/// </summary>
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public PlantDataController(GWMSDataService DataService)
|
||||
{
|
||||
_DataService = DataService;
|
||||
Log.Info("Avviata classe PlantDataController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -36,12 +47,14 @@ namespace GWMS.UI.Controllers
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
Log.Debug($"Chiamata Delete | {id}");
|
||||
}
|
||||
|
||||
// GET: api/PlantData
|
||||
[HttpGet]
|
||||
public async Task<List<PlantDTO>> Get()
|
||||
{
|
||||
Log.Debug("Chiamata Get");
|
||||
// serializzo i dati di PlantDTO dell'impianto richiesto
|
||||
List<PlantDTO> ListRecords = await _DataService.PlantsGetAll();
|
||||
return ListRecords;
|
||||
@@ -51,6 +64,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("{id}")]
|
||||
public async Task<PlantDTO> Get(int id)
|
||||
{
|
||||
Log.Debug($"Chiamata Get | {id}");
|
||||
// serializzo i dati di PlantDTO dell'impianto richiesto
|
||||
var ListRecords = await _DataService.PlantsGetAll();
|
||||
//seleziono plant...
|
||||
@@ -62,12 +76,14 @@ namespace GWMS.UI.Controllers
|
||||
[HttpPost]
|
||||
public void Post([FromBody] string value)
|
||||
{
|
||||
Log.Debug("Chiamata Post");
|
||||
}
|
||||
|
||||
// PUT api/PlantData/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
Log.Debug($"Chiamata Put | {id}");
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -15,11 +16,21 @@ namespace GWMS.UI.Controllers
|
||||
[ApiController]
|
||||
public class PlantLogController : ControllerBase
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Classe per logging
|
||||
/// </summary>
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public PlantLogController(GWMSDataService DataService)
|
||||
{
|
||||
_DataService = DataService;
|
||||
Log.Debug("Avviata classe PlantDataController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -36,12 +47,14 @@ namespace GWMS.UI.Controllers
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
Log.Debug($"Chiamata Delete | {id}");
|
||||
}
|
||||
|
||||
// GET: api/PlantLog
|
||||
[HttpGet]
|
||||
public async Task<List<PlantLogModel>> Get()
|
||||
{
|
||||
Log.Debug("Chiamata Get");
|
||||
// arrotondo ai 5 minuti
|
||||
DateTime adesso = DateTime.Now;
|
||||
int dayHour = adesso.Hour;
|
||||
@@ -57,6 +70,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpGet("{id}")]
|
||||
public async Task<List<PlantLogModel>> Get(int id)
|
||||
{
|
||||
Log.Debug($"Chiamata Get | {id}");
|
||||
// arrotondo ai 5 minuti
|
||||
DateTime adesso = DateTime.Now;
|
||||
int dayHour = adesso.Hour;
|
||||
@@ -72,6 +86,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> Post([FromBody] List<PlantLogModel> newItems)
|
||||
{
|
||||
Log.Debug("Chiamata Post");
|
||||
bool fatto = false;
|
||||
// verifico ci sia valore
|
||||
if (newItems != null)
|
||||
@@ -92,6 +107,7 @@ namespace GWMS.UI.Controllers
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
Log.Debug($"Chiamata Put | {id}");
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -19,7 +19,7 @@ using System.Globalization;
|
||||
|
||||
namespace GWMS.UI.Data
|
||||
{
|
||||
public class GWMSDataService
|
||||
public class GWMSDataService : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
@@ -73,9 +73,9 @@ namespace GWMS.UI.Data
|
||||
else
|
||||
{
|
||||
dbController = new GWMS.Data.Controllers.GWMSController(configuration);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine($"DbController OK");
|
||||
_logger.LogInformation(sb.ToString());
|
||||
//StringBuilder sb = new StringBuilder();
|
||||
//sb.AppendLine($"DbController OK");
|
||||
//_logger.LogInformation(sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,6 +394,12 @@ namespace GWMS.UI.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
}
|
||||
|
||||
public async Task<bool> HasPlantLog()
|
||||
{
|
||||
return await Task.FromResult(dbController.HasPlantLog());
|
||||
@@ -662,11 +668,6 @@ namespace GWMS.UI.Data
|
||||
{ }
|
||||
}
|
||||
|
||||
public async Task<bool> RegenDB(int numDays, int stepMin = 30, int maxHourRate = 800)
|
||||
{
|
||||
return await Task.FromResult(dbController.RegenDB(1, numDays, stepMin, maxHourRate));
|
||||
}
|
||||
|
||||
public void ResetController()
|
||||
{
|
||||
dbController.ResetController();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Version>1.0.2108.2713</Version>
|
||||
<Version>1.0.2108.3011</Version>
|
||||
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
return;
|
||||
|
||||
processRunning = true;
|
||||
DataService.RegenDB(numDays, stepMin, maxHourRate);
|
||||
//DataService.RegenDB(numDays, stepMin, maxHourRate);
|
||||
processRunning = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@
|
||||
new QRCode(document.getElementById(elementName),
|
||||
{
|
||||
text: rawData,
|
||||
width: 400,
|
||||
height: 400
|
||||
width: 300,
|
||||
height: 300
|
||||
});
|
||||
//qrcode.makeCode(rawData);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GWMS - Gas Warehouse Management System</i>
|
||||
<h4>Versione: 1.0.2108.2713</h4>
|
||||
<h4>Versione: 1.0.2108.3011</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.2108.2713
|
||||
1.0.2108.3011
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.0.2108.2713</version>
|
||||
<version>1.0.2108.3011</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>
|
||||
|
||||
Reference in New Issue
Block a user