Merge branch 'release/UpdateIndexLayout'

This commit is contained in:
Samuele Locatelli
2022-10-04 19:25:16 +02:00
79 changed files with 4921 additions and 898 deletions
+7 -7
View File
@@ -111,7 +111,7 @@
"Order": 9,
"ExtCode": "ns=1;s=5_10_TOOL 22 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 3 TOOL 2",
"Title": "SPINDLE 3 TOOL 02",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
@@ -123,7 +123,7 @@
"Order": 10,
"ExtCode": "ns=1;s=5_11_TOOL 23 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 3 TOOL 3",
"Title": "SPINDLE 3 TOOL 03",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
@@ -135,7 +135,7 @@
"Order": 11,
"ExtCode": "ns=1;s=5_12_TOOL 24 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 3 TOOL 4",
"Title": "SPINDLE 3 TOOL 04",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
@@ -147,7 +147,7 @@
"Order": 12,
"ExtCode": "ns=1;s=5_13_TOOL 31 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 1",
"Title": "SPINDLE 4 TOOL 01",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
@@ -159,7 +159,7 @@
"Order": 13,
"ExtCode": "ns=1;s=5_14_TOOL 32 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 2",
"Title": "SPINDLE 4 TOOL 02",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
@@ -171,7 +171,7 @@
"Order": 14,
"ExtCode": "ns=1;s=5_15_TOOL 33 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 3",
"Title": "SPINDLE 4 TOOL 03",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
@@ -183,7 +183,7 @@
"Order": 15,
"ExtCode": "ns=1;s=5_16_TOOL 34 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 4",
"Title": "SPINDLE 4 TOOL 04",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
+11 -1
View File
@@ -764,10 +764,20 @@ namespace MP.MONO.ADAPTER.OPC
currItem.Value = rawDataVal;
}
logTrace($"R&S | ToolKList | {uuid} | {currItem.Value}");
#if false
// prendo tutti i valori del gruppo e li serializzo come DisplayDataDTO
string payloadTools = JsonConvert.SerializeObject(ToolStatus);
// invio
saveAndSendMessage(Constants.TOOLS_CURR_KEY, Constants.TOOLS_M_QUEUE, payloadTools);
saveAndSendMessage(Constants.TOOLS_CURR_KEY, Constants.TOOLS_M_QUEUE, payloadTools);
#endif
// genero un dictionary di valori stringa / double e lo serializzo...
var dataDict = ToolStatus.ToDictionary(x => x.Title, x => x.Value);
string payloadTools = JsonConvert.SerializeObject(dataDict);
// invio
saveAndSendMessage(Constants.TOOLS_ACT_KEY, Constants.TOOLS_RAW_QUEUE, payloadTools);
}
// Parameters
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2318</Version>
<Version>1.2.2210.419</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2318</h4>
<h4>Version: 1.2.2210.419</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2318
1.2.2210.419
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2318</version>
<version>1.2.2210.419</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+3 -1
View File
@@ -52,6 +52,7 @@ namespace MP.MONO.Core
public static readonly string PROD_CURR_KEY = $"{BASE_HASH}:Current:Production";
public static readonly string STATUS_ACT_KEY = $"{BASE_HASH}:Current:StatusVal";
public static readonly string STATUS_CURR_KEY = $"{BASE_HASH}:Current:Status";
public static readonly string TOOLS_ACT_KEY = $"{BASE_HASH}:Current:ToolsVal";
public static readonly string TOOLS_CURR_KEY = $"{BASE_HASH}:Current:Tools";
public static readonly string COUNT_CURR_KEY = $"{BASE_HASH}:Current:Counters";
@@ -74,9 +75,10 @@ namespace MP.MONO.Core
// REDIS Channels messaggi (verso DECODER)
public static readonly string ALARM_RAW_QUEUE = $"AlarmsRawVal";
public static readonly string COUNT_RAW_QUEUE = $"CountRawVal";
public static readonly string PARAMS_RAW_QUEUE = $"ParamsRawVal";
public static readonly string STATUS_RAW_QUEUE = $"StatusRawVal";
public static readonly string COUNT_RAW_QUEUE = $"CountRawVal";
public static readonly string TOOLS_RAW_QUEUE = $"ToolsRawVal";
#endregion Public Fields
}
+12 -2
View File
@@ -20,6 +20,16 @@
OR
}
/// <summary>
/// Tipo di dati salvato in DataLog
/// </summary>
public enum DataLogType
{
ND = 0,
Parameter = 1,
Tools
}
/// <summary>
/// Categoria dataItem
/// </summary>
@@ -35,8 +45,8 @@
/// </summary>
public enum AlarmReportingMode
{
ND=0,
ND = 0,
/// <summary>
/// MOdalità report per bank di memoria + bitmap degli allarmi attivi nel bank
/// </summary>
+4 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2318</Version>
<Version>1.2.2210.419</Version>
</PropertyGroup>
<ItemGroup>
@@ -75,6 +75,9 @@
<None Update="lua\prova.lua">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="lua\ToolsDecoder.lua">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
+1
View File
@@ -133,6 +133,7 @@ namespace MP.MONO.DECODER
DtRif = adesso,
FluxType = item.Key,
MachineId = 1,
DataType = Enums.DataLogType.Parameter,
ValNum = calcVal,
ValStr = $"{calcVal:N3}"
+95
View File
@@ -100,6 +100,7 @@ setupConf();
DateTime lastExecParams = DateTime.Now.AddHours(-1);
DateTime lastLogDetail = DateTime.Now.AddHours(-1);
int numSendParam = 1;
int numSendTools = 1;
int numSendMStatus = 1;
/* --------------------------------
@@ -126,6 +127,19 @@ DateTime lastExecStatus = DateTime.Now.AddHours(-1);
// registro gestione eventi
mpStatusRecvPipe.EA_NewMessage += MpStatusRecvPipe_EA_NewMessage;
/* --------------------------------
* Setup Gestione Tools
* --------------------------------*/
ToolsManager toolsMan = new ToolsManager();
// inizializzo gestione messagePipe da Redis x allarmi
MessagePipe toolsSendPipe = new MessagePipe(redisConn, Constants.TOOLS_M_QUEUE);
MessagePipe toolsRecvPipe = new MessagePipe(redisConn, Constants.TOOLS_RAW_QUEUE);
// datetime dell'inizio esecuzione task... x usare un semaforo di veto doppia esecuzione entro 30 sec
DateTime lastExecTools = DateTime.Now.AddHours(-1);
// registro gestione eventi
toolsRecvPipe.EA_NewMessage += ToolsRecvPipe_EA_NewMessage;
/* --------------------------------
* Setup Gestione Parametri
* --------------------------------*/
@@ -535,6 +549,87 @@ void AlarmsValPipe_EA_NewMessage(object? sender, EventArgs e)
}
}
/// <summary>
/// Gestione evento ricezione messaggi tools
/// </summary>
void ToolsRecvPipe_EA_NewMessage(object? sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// conversione on-the-fly Dictionary<string,int> --> parametri valorizzati (tra quelli configurati)
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
DateTime adesso = DateTime.Now;
List<DisplayDataDTO>? redisToolsConf = new List<DisplayDataDTO>();
try
{
// verifico codici ricevuti
var toolsList = JsonConvert.DeserializeObject<Dictionary<string, double>>(currArgs.newMessage);
if (toolsList != null)
{
// recupero elenco parametri salvati in redis...
string rawData = redisDb.StringGet(Constants.TOOLS_CONF_KEY);
if (!string.IsNullOrEmpty(rawData))
{
redisToolsConf = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(rawData);
// se ho i parametri...
if (redisToolsConf != null)
{
// ciclo x ogni valore ricevuto da message service...
foreach (var item in toolsList)
{
// cerco il parametro corrispondente...
var currToolVal = redisToolsConf.FirstOrDefault(x => x.Title == item.Key);
if (currToolVal != null)
{
currToolVal.ValueNum = item.Value;
currToolVal.Value = $"{item.Value.ToString(currToolVal.DisplFormat)}";
}
}
// verifico NON ci sia veto di scrittura... DbSampleInt (60 sec...)
if (adesso.Subtract(lastExecTools).TotalSeconds > DbSampleInt)
{
lastExecTools = adesso;
if (dbController != null)
{
// verifico x ogni parametro se sia completato il periodo di campionamento...
var val2save = toolsMan.processData(toolsList, redisToolsConf);
if (val2save.Count > 0)
{
// salvo sul DB
_ = dbController.DataLogInsertMany(val2save).Result;
Log.Info($"Tools | DB | {val2save.Count} rec inserted");
}
}
}
}
}
// invio sulla message pipeline corretta TUTTI i parametri aggiornati serializzati
string updRawVal = JsonConvert.SerializeObject(redisToolsConf);
toolsSendPipe.saveAndSendMessage(Constants.TOOLS_CURR_KEY, updRawVal);
if (redisToolsConf != null)
{
if (adesso.Subtract(lastLogDetail).TotalSeconds > 5 || numSendTools > 10)
{
Log.Info($"TOOLS | {redisToolsConf.Count} data transmitted x {numSendTools}");
lastLogDetail = adesso;
numSendTools = 0;
}
else
{
numSendTools++;
}
}
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in ToolsRecvPipe_EA_NewMessage:{Environment.NewLine}{exc}{Environment.NewLine}{currArgs.newMessage}");
}
}
}
/// <summary>
/// Gestione evento ricezione messaggi parametri
/// </summary>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2318</h4>
<h4>Version: 1.2.2210.419</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2318
1.2.2210.419
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2318</version>
<version>1.2.2210.419</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+155
View File
@@ -0,0 +1,155 @@
using MP.MONO.Core;
using MP.MONO.Core.DTO;
using MP.MONO.Data.DbModels;
using NLog;
using NLua;
namespace MP.MONO.DECODER
{
public class ToolsManager
{
#region Private Fields
/// <summary>
/// Dizionario dei valori accumulati sulle variabili
/// </summary>
private Dictionary<string, VCData> VarAccumulator = new Dictionary<string, VCData>();
#endregion Private Fields
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
protected static string luaPath = "";
protected static Lua state = new Lua();
protected List<string> AlarmList = new List<string>();
#endregion Protected Fields
#region Public Fields
public static string alarmStatus = "";
public static bool valueChanged = false;
#endregion Public Fields
#region Public Constructors
public ToolsManager()
{
// preparo variabile x avvisare script che il modo è da NLua
state["callMode"] = "NLua";
state["vcFunct"] = "AVG";
// carico il file (derivato da quello dei parametri)
luaPath = Path.Combine(Directory.GetCurrentDirectory(), "lua", "ToolsDecoder.lua");
state.DoFile(luaPath);
Log.Info("ToolsManager OK");
Console.WriteLine("ToolsManager OK");
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Funzione chiamata LUA x calcolo degli eventuali tools val con periodi "scaduti"
/// </summary>
/// <param name="paramsList"></param>
/// <param name="redisToolsConf"></param>
/// <returns></returns>
public List<DataLogModel> processData(Dictionary<string, double> paramsList, List<DisplayDataDTO> redisToolsConf)
{
List<DataLogModel> answ = new List<DataLogModel>();
DateTime adesso = DateTime.Now;
// vado ad "accumulare i dati" a quelli presenti...
foreach (var item in paramsList)
{
var currParam = redisToolsConf.FirstOrDefault(x => x.Title == item.Key);
// cerco nelle variabili accomulatori...
if (!VarAccumulator.ContainsKey(item.Key))
{
if (currParam != null)
{
var dataList = new List<double>();
dataList.Add(item.Value);
VCData newSet = new VCData()
{
dataArray = dataList,
DTStart = adesso,
Funzione = currParam.VcFunc,
Period = currParam.SamplePeriod
};
// se non ci fosse creo
VarAccumulator.Add(item.Key, newSet);
}
}
else
{
// altrimenti aggiorno
VarAccumulator[item.Key].dataArray.Add(item.Value);
}
// effettuo verifiche scadenza
bool calcOk = false;
double calcVal = 0;
if (VarAccumulator.ContainsKey(item.Key))
{
if (VarAccumulator[item.Key].isElapsed)
{
string funcMode = $"{VarAccumulator[item.Key].Funzione}";
// se scaduto --> mando a LUA x calcolo
state["valList"] = VarAccumulator[item.Key].dataArray;
state["numRec"] = VarAccumulator[item.Key].dataArray.Count;
state["vcFunct"] = funcMode;
// effettuo calcolo
state.DoString("doProcess()");
// recupero valore calcolato
bool.TryParse(state.GetString("calcOk"), out calcOk);
if (calcOk)
{
try
{
var stringVal = state.GetString("calcVal");
if (!string.IsNullOrEmpty(stringVal))
{
calcVal = state.GetNumber("calcVal");
Log.Trace($"calcVal: {calcVal}");
}
}
catch (Exception exc)
{
Log.Error($"exception during processData for {item.Key}{Environment.NewLine}{exc}");
}
}
// aggiungo alla lista finale...
var dbRecord = new DataLogModel()
{
DtRif = adesso,
FluxType = item.Key,
MachineId = 1,
DataType = Enums.DataLogType.Tools,
ValNum = calcVal,
ValStr = $"{calcVal:N3}"
};
answ.Add(dbRecord);
// elimino dai valori accumulati...
VarAccumulator.Remove(item.Key);
}
}
}
return answ;
}
#endregion Public Methods
}
}
+2 -2
View File
@@ -1,10 +1,10 @@
--[[---------------------------------------------------
Procedura calcolo statistiche parametri:
Procedura calcolo statistiche counters (derivato dai parametri):
Variabili IN:
- vcFunct(string): tipo di processing da effettuare tra [POINT/AVG/MEDIAN/MIN/MAX]
- valList(<double>): elenco VALORI double da processare
- numRec(int): conteggio numero recorda da processare
- numRec(int): conteggio numero record da processare
Variabili OUT:
- calcVal(double): valore calcolato finale
+1 -1
View File
@@ -4,7 +4,7 @@ Procedura calcolo statistiche parametri:
Variabili IN:
- vcFunct(string): tipo di processing da effettuare tra [POINT/AVG/MEDIAN/MIN/MAX]
- valList(<double>): elenco VALORI double da processare
- numRec(int): conteggio numero recorda da processare
- numRec(int): conteggio numero record da processare
Variabili OUT:
- calcVal(double): valore calcolato finale
+105
View File
@@ -0,0 +1,105 @@
--[[---------------------------------------------------
Procedura calcolo statistiche TOOLS:
Variabili IN:
- vcFunct(string): tipo di processing da effettuare tra [POINT/AVG/MEDIAN/MIN/MAX]
- valList(<double>): elenco VALORI double da processare
- numRec(int): conteggio numero record da processare
Variabili OUT:
- calcVal(double): valore calcolato finale
-----------------------------------------------------]]
-- Per eventuale debug
local ZBS = "c:/ZeroBraneStudio"
if not package.path:find(ZBS,1,true) then
package.path = ZBS .. "/lualibs/?/?.lua;" .. ZBS .. "/lualibs/?.lua;" .. package.path
package.cpath = ZBS .. "/bin/?.dll;" .. ZBS .. "/bin/clibs53/?.dll;" .. package.cpath
end
-- se non è da NLua inizializzo variabili accessorie
local function checkInit()
if (callMode ~= 'NLua') then
-- imposto valori test
valList = { 4467, 4468, 4467, 4467, 4467, 4467 }
numRec = #valList
--valList = { 4.0, 5.0, 3.0, 6.0, 1.0, 2.0 }
vcFunct = 'AVG'
--POINT AVG MEDIAN MIN MAX
end
end
local function setupTable()
if numRec > 0 and valList[0] ~= nil then
for i = numRec, 1, -1 do
valListTable[i] = valList[i-1]
end
else
valListTable = valList
end
end
local function doCalc()
if(numRec > 0) then
-- verifica il tipo di richiesta
if(vcFunct == 'AVG') then
s = 0
for i,v in ipairs(valListTable) do
s = s + v
end
calcVal = s / numRec
elseif(vcFunct == 'POINT') then
calcVal = valListTable[numRec]
elseif(vcFunct == 'MEDIAN') then
table.sort(valListTable)
calcVal = valListTable[numRec/2]
elseif(vcFunct == 'MIN') then
table.sort(valListTable)
calcVal = valListTable[1]
elseif(vcFunct == 'MAX') then
table.sort(valListTable)
calcVal = valListTable[numRec]
end
calcOk = true
else
calcVal = -999999
numRec = 1
calcOk = false
end
end
local function displayTestInfo()
if (callMode ~= 'NLua') then
print('------------------------------')
print('calcOk: ' .. tostring(calcOk) .. ' | vcFunct: ' .. vcFunct)
for i,val in pairs(valList) do
print("v_"..i.." | "..val)
end
print('calcVal: ' .. calcVal)
print('------------------------------')
end
end
-- MAIN
function doProcess()
-- variabile semaforo callMode (locali o remote da NLua)
callMode = callMode or ''
calcVal = -999
vcFunct = vcFunct or ''
valList = valList or {}
numRec = numRec or 1
calcOk = false
valListTable = {}
checkInit()
setupTable()
doCalc()
displayTestInfo()
end
if (callMode ~= 'NLua') then
doProcess()
end
+75 -8
View File
@@ -4,6 +4,7 @@ using MP.MONO.Data.DbModels;
using MP.MONO.Data.DTO;
using NLog;
using System.Diagnostics;
using static MP.MONO.Core.Enums;
namespace MP.MONO.Data.Controllers
{
@@ -139,6 +140,37 @@ namespace MP.MONO.Data.Controllers
}
return dbResult;
}
/// <summary>
/// Recupero elenco allarmi con data <= alla data di riferimento (ultimi dato "skip")
/// </summary>
/// <param name="MachineId"></param>
/// <param name="dtRif"></param>
/// <param name="skipRec"></param>
/// <param name="numRec"></param>
/// <returns></returns>
public List<AlarmLogModel> AlarmLogGetFiltByDate(int MachineId,DateTime dtRif, int skipRec, int numRec)
{
List<AlarmLogModel> dbResult = new List<AlarmLogModel>();
using (MapoMonoContext localDbCtx = new MapoMonoContext())
{
try
{
dbResult = localDbCtx
.DbSetAlarmLog
.Where(x => (x.MachineId == MachineId) && (x.DtRif <= dtRif))
.Include(m => m.MachineNav)
.OrderByDescending(x => x.AlarmLogId)
.Skip(skipRec)
.Take(numRec)
.ToList();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante AlarmLogGetFilt{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// Inserimento di un record AlarmLog
@@ -261,6 +293,39 @@ namespace MP.MONO.Data.Controllers
return dbResult;
}
/// <summary>
/// Recupero elenco allarmi Rec con data <= a quella di riferimento(ultimi dato "skip")
/// </summary>
/// <param name="MachineId"></param>
/// <param name="dtRif"></param>
/// <param name="skipRec"></param>
/// <param name="numRec"></param>
/// <returns></returns>
public List<AlarmRecModel> AlarmRecGetFiltByDate(int MachineId, DateTime dtRif, int skipRec, int numRec)
{
List<AlarmRecModel> dbResult = new List<AlarmRecModel>();
using (MapoMonoContext localDbCtx = new MapoMonoContext())
{
try
{
dbResult = localDbCtx
.DbSetAlarmRec
.Where(x => (x.MachineId == MachineId) && (x.DtStart <= dtRif))
.Include(m => m.MachineNav)
.Include(m => m.AlarmListNav)
.OrderByDescending(x => x.DtStart)
.Skip(skipRec)
.Take(numRec)
.ToList();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante AlarmRecGetFilt{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// Recupero lista sommatoria durata eventi allarme per analisi, ordinati in logica di
/// pareto (Max-min)
@@ -430,11 +495,12 @@ namespace MP.MONO.Data.Controllers
/// Recupero record DataLog data condizione filtro
/// </summary>
/// <param name="machineId"></param>
/// <param name="dataType">Tipologia di dato richiesto da enum</param>
/// <param name="fluxType"></param>
/// <param name="inizio"></param>
/// <param name="fine"></param>
/// <returns></returns>
public List<DataLogModel> DataLogGetFilt(int machineId, string fluxType, DateTime inizio, DateTime fine)
public List<DataLogModel> DataLogGetFilt(int machineId, DataLogType dataType, string fluxType, DateTime inizio, DateTime fine)
{
List<DataLogModel> dbResult = new List<DataLogModel>();
using (MapoMonoContext localDbCtx = new MapoMonoContext())
@@ -443,7 +509,7 @@ namespace MP.MONO.Data.Controllers
{
dbResult = localDbCtx
.DbSetDataLog
.Where(x => x.MachineId == machineId && x.FluxType == fluxType && x.DtRif >= inizio && x.DtRif <= fine)
.Where(x => (x.MachineId == machineId) && (x.FluxType == fluxType) && (x.DataType == dataType || dataType == DataLogType.ND) && (x.DtRif >= inizio && x.DtRif <= fine))
.Include(m => m.MachineNav)
.OrderByDescending(x => x.DataLogId)
.ToList();
@@ -459,12 +525,13 @@ namespace MP.MONO.Data.Controllers
/// <summary>
/// Recupero DataLogDTO data condizione filtro
/// </summary>
/// <param name="machineId"></param>
/// <param name="fluxType"></param>
/// <param name="inizio"></param>
/// <param name="fine"></param>
/// <param name="machineId">ID macchina</param>
/// <param name="dataType">Tipologia di dato richiesto da enum</param>
/// <param name="fluxType">Tipo di Flusso</param>
/// <param name="inizio">DT Inizio estrazione</param>
/// <param name="fine">DT Fine estrazione</param>
/// <returns></returns>
public List<DataLogDTO> DataLogDtoGetFilt(int machineId, string fluxType, DateTime inizio, DateTime fine)
public List<DataLogDTO> DataLogDtoGetFilt(int machineId, DataLogType dataType, string fluxType, DateTime inizio, DateTime fine)
{
List<DataLogDTO> dbResult = new List<DataLogDTO>();
using (MapoMonoContext localDbCtx = new MapoMonoContext())
@@ -473,7 +540,7 @@ namespace MP.MONO.Data.Controllers
{
dbResult = localDbCtx
.DbSetDataLog
.Where(x => x.MachineId == machineId && x.FluxType == fluxType && x.DtRif >= inizio && x.DtRif <= fine)
.Where(x => (x.MachineId == machineId) && (x.FluxType == fluxType) && (x.DataType == dataType || dataType== DataLogType.ND) && (x.DtRif >= inizio && x.DtRif <= fine))
.Select(r => new DataLogDTO() { DataLogId=r.DataLogId, DtRif=r.DtRif, ValNum=r.ValNum })
.OrderByDescending(x => x.DataLogId)
.ToList();
+13 -5
View File
@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static MP.MONO.Core.Enums;
// <Auto-Generated>
@@ -19,6 +20,18 @@ namespace MP.MONO.Data.DbModels
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int DataLogId { get; set; }
/// <summary>
/// Macchina cui è riferito il valore
/// </summary>
public int MachineId { get; set; }
/// <summary>
/// Tipologia del dato cui è riferito il valore
/// </summary>
public DataLogType DataType { get; set; } = DataLogType.Parameter;
/// <summary>
/// DataOra evento registrato
/// </summary>
@@ -30,11 +43,6 @@ namespace MP.MONO.Data.DbModels
[MaxLength(250)]
public string FluxType { get; set; } = "ND";
/// <summary>
/// Macchina cui è riferito il valore
/// </summary>
public int MachineId { get; set; }
/// <summary>
/// Valore formato numerico (0 se non numerico)
/// </summary>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MP.MONO.Data.Migrations
{
public partial class UpdateDatalogModel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "DataType",
table: "DataLog",
type: "int",
nullable: false,
defaultValue: 1);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DataType",
table: "DataLog");
}
}
}
@@ -227,6 +227,9 @@ namespace MP.MONO.Data.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("DataType")
.HasColumnType("int");
b.Property<DateTime>("DtRif")
.HasColumnType("datetime(6)");
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2318</Version>
<Version>1.2.2210.419</Version>
</PropertyGroup>
<ItemGroup>
+2 -2
View File
@@ -511,9 +511,9 @@ void simTools()
do
{
// recupero uno stato simulato
var newVal = currSimGen.getTools();
var newVal = currSimGen.getToolsKVP();
string rawData = JsonConvert.SerializeObject(newVal);
saveAndSendMessage(Constants.TOOLS_CURR_KEY, Constants.TOOLS_M_QUEUE, rawData);
saveAndSendMessage(Constants.TOOLS_ACT_KEY, Constants.TOOLS_RAW_QUEUE, rawData);
// attesa random
Thread.Sleep(rand.Next(minPeriod, maxPeriod));
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2318</h4>
<h4>Version: 1.2.2210.419</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2318
1.2.2210.419
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2318</version>
<version>1.2.2210.419</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+26 -5
View File
@@ -343,8 +343,11 @@ namespace MachineSim
answ.Add("RECIPE NAME", $"{DateTime.Now:yyMMdd-HHmm}.prg");
return answ;
}
public List<DisplayDataDTO> getTools()
/// <summary>
/// Simulo dati in formato DTO (già finale)
/// </summary>
/// <returns></returns>
public List<DisplayDataDTO> getToolsDTO()
{
List<DisplayDataDTO> answ = new List<DisplayDataDTO>();
@@ -358,7 +361,12 @@ namespace MachineSim
Title = i.Title,
Type = i.Type,
ValueNum = simNext(i.ValueNum, i.MinVal, i.MaxVal, i.SimMean, i.SimStd, 3),
DisplFormat = i.DisplFormat
DisplFormat = i.DisplFormat,
EnablePlot = i.EnablePlot,
ShowBar = i.ShowBar,
ShowGauge = i.ShowGauge,
CssIcon = i.CssIcon,
HLShow = i.HLShow
}).ToList();
foreach (var item in answ)
@@ -374,6 +382,19 @@ namespace MachineSim
return answ;
}
/// <summary>
/// Mostro un valore in formato chiave/valore (stringa/double)
/// </summary>
/// <returns></returns>
public Dictionary<string, double> getToolsKVP()
{
Dictionary<string, double> answ = new Dictionary<string, double>();
// calcolo come DTO (e così si aggiorna trend)
var randDto = getToolsDTO();
// genero a partire dall'elenco configurato da simulare...
answ = randDto.ToDictionary(i => i.Title, i => i.ValueNum);
return answ;
}
/// <summary>
/// Calcola prox valore simulato dati i parametri rand configurati, con innovazione
@@ -389,12 +410,12 @@ namespace MachineSim
/// <param name="MaxVal"></param>
/// <param name="sMean"></param>
/// <param name="sStd"></param>
/// <param name="trueRatio"></param>
/// <param name="simMode">Modalità simulazione
/// <param name="simMode">Modalità simulazione (1-3)
/// 1 = std, RandomWalk + trend periodico con memoria
/// 2 = boolean
/// 3 = trend secondo valore mean (crescente se >0, decrescente se <0)
/// </param>
/// <param name="trueRatio"></param>
/// <returns></returns>
public double simNext(double CurrVal, double MinVal, double MaxVal, double sMean, double sStd, int simMode = 1, double trueRatio = 0.5)
{
+232 -12
View File
@@ -1,38 +1,258 @@
[
{
"Order": 0,
"HLShow": true,
"Type": "TOOL",
"Title": "Tool 01 life",
"Title": "SPINDLE 1 TOOL 01",
"Value": "99",
"ValueNum": 99,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -1.5,
"SimStd": 0.5,
"DisplFormat": "N1"
"SimMean": -0.015,
"SimStd": 0.0125,
"DisplFormat": "N2",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true
},
{
"Order": 1,
"Type": "TOOL",
"Title": "Tool 02 life",
"Title": "SPINDLE 1 TOOL 02",
"HLShow": true,
"Value": "85",
"ValueNum": 85,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -1,
"SimStd": 1,
"DisplFormat": "N1"
"SimMean": -0.1,
"SimStd": 0.025,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 2,
"Type": "TOOL",
"Title": "Tool 03 life",
"Title": "SPINDLE 1 TOOL 03",
"HLShow": false,
"Value": "70",
"ValueNum": 70,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -2.5,
"SimStd": 2,
"DisplFormat": "N1"
"SimMean": -0.012,
"SimStd": 0.04,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 3,
"Type": "TOOL",
"Title": "SPINDLE 1 TOOL 04",
"HLShow": false,
"Value": "70",
"ValueNum": 70,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.012,
"SimStd": 0.04,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 10,
"Type": "TOOL",
"Title": "SPINDLE 2 TOOL 01",
"HLShow": true,
"Value": "99",
"ValueNum": 99,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.015,
"SimStd": 0.0125,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 11,
"Type": "TOOL",
"Title": "SPINDLE 2 TOOL 02",
"HLShow": true,
"Value": "85",
"ValueNum": 85,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.015,
"SimStd": 0.025,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 12,
"Type": "TOOL",
"Title": "SPINDLE 2 TOOL 03",
"HLShow": false,
"Value": "70",
"ValueNum": 70,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.035,
"SimStd": 0.04,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 13,
"Type": "TOOL",
"Title": "SPINDLE 2 TOOL 04",
"HLShow": false,
"Value": "70",
"ValueNum": 70,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.035,
"SimStd": 0.04,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 20,
"Type": "TOOL",
"Title": "SPINDLE 3 TOOL 01",
"HLShow": true,
"Value": "99",
"ValueNum": 99,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.015,
"SimStd": 0.0125,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 21,
"Type": "TOOL",
"Title": "SPINDLE 3 TOOL 02",
"HLShow": true,
"Value": "85",
"ValueNum": 85,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.015,
"SimStd": 0.025,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 22,
"Type": "TOOL",
"Title": "SPINDLE 3 TOOL 03",
"HLShow": false,
"Value": "70",
"ValueNum": 70,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.035,
"SimStd": 0.04,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 23,
"Type": "TOOL",
"Title": "SPINDLE 3 TOOL 04",
"HLShow": false,
"Value": "70",
"ValueNum": 70,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.035,
"SimStd": 0.04,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 30,
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 01",
"HLShow": true,
"Value": "99",
"ValueNum": 99,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.015,
"SimStd": 0.0125,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 31,
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 02",
"HLShow": true,
"Value": "85",
"ValueNum": 85,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.015,
"SimStd": 0.025,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 32,
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 03",
"HLShow": false,
"Value": "70",
"ValueNum": 70,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.035,
"SimStd": 0.04,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
},
{
"Order": 33,
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 04",
"HLShow": false,
"Value": "70",
"ValueNum": 70,
"MinVal": 0,
"MaxVal": 100,
"SimMean": -0.035,
"SimStd": 0.04,
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"DisplFormat": "N2"
}
]
+135 -71
View File
@@ -6,10 +6,14 @@
"Title": "SPINDLE 1 TOOL 01",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": true
},
{
"Order": 1,
@@ -18,10 +22,14 @@
"Title": "SPINDLE 1 TOOL 02",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": true
},
{
"Order": 2,
@@ -30,10 +38,14 @@
"Title": "SPINDLE 1 TOOL 03",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": false
},
{
"Order": 3,
@@ -42,10 +54,14 @@
"Title": "SPINDLE 1 TOOL 04",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": false
},
{
"Order": 4,
@@ -54,10 +70,14 @@
"Title": "SPINDLE 2 TOOL 01",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": true
},
{
"Order": 5,
@@ -66,10 +86,14 @@
"Title": "SPINDLE 2 TOOL 02",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": true
},
{
"Order": 6,
@@ -78,10 +102,14 @@
"Title": "SPINDLE 2 TOOL 03",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": false
},
{
"Order": 7,
@@ -90,10 +118,14 @@
"Title": "SPINDLE 2 TOOL 04",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": false
},
{
"Order": 8,
@@ -102,93 +134,125 @@
"Title": "SPINDLE 3 TOOL 01",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": true
},
{
"Order": 9,
"ExtCode": "ns=1;s=5_10_TOOL 22 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 3 TOOL 2",
"Title": "SPINDLE 3 TOOL 02",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": true
},
{
"Order": 10,
"ExtCode": "ns=1;s=5_11_TOOL 23 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 3 TOOL 3",
"Title": "SPINDLE 3 TOOL 03",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": false
},
{
"Order": 11,
"ExtCode": "ns=1;s=5_12_TOOL 24 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 3 TOOL 4",
"Title": "SPINDLE 3 TOOL 04",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": false
},
{
"Order": 12,
"ExtCode": "ns=1;s=5_13_TOOL 31 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 1",
"Title": "SPINDLE 4 TOOL 01",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": true
},
{
"Order": 13,
"ExtCode": "ns=1;s=5_14_TOOL 32 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 2",
"Title": "SPINDLE 4 TOOL 02",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": true
},
{
"Order": 14,
"ExtCode": "ns=1;s=5_15_TOOL 33 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 3",
"Title": "SPINDLE 4 TOOL 03",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": false
},
{
"Order": 15,
"ExtCode": "ns=1;s=5_16_TOOL 34 CURRENT LIFE PC",
"Type": "TOOL",
"Title": "SPINDLE 4 TOOL 4",
"Title": "SPINDLE 4 TOOL 04",
"Value": "0",
"ValueNum": 0,
"MinVal": -9999,
"MaxVal": 9999,
"DisplFormat": "N1",
"IsNumeric": true
"MinVal": 0,
"MaxVal": 100,
"DisplFormat": "N2",
"VcFunc": "AVG",
"IsNumeric": true,
"EnablePlot": true,
"ShowBar": true,
"HLShow": false
}
]
+39
View File
@@ -0,0 +1,39 @@
<div class="d-flex justify-content-between">
<div class="d-flex justify-content-between pt-2 mb-1">
@*<span class="py-1">Mode:</span>*@
@*<div class="form-switch mx-3 py-1 d-flex justify-content-between">
<input class="form-check-input py-1" type="checkbox" role="switch" id="toggleRec" title="Show Alarms log or Alarm rec" @onclick="() => toggleRec()">
<b><label for="toggleRec">&nbsp;@currMode</label></b>
</div>*@
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1 @DUCSSmode">DURATION</span>
<div class="form-check form-check-sm form-switch py-1" title="Parameter View Mode (RealTime / LogData)">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" title="Show Alarms frequency or Alarms duration" checked @onclick="() => toggleRec()">
</div>
<span class="@FRCSSmode">FREQUENCY</span>
</div>
</div>
</div>
<div class="d-flex justify-content-between pt-0">
@if (showParams)
{
<div class="input-group pt-0">
<label class="input-group-text" title="Analisys: dataset start">Start</label>
<input @bind="@dtStart" id="DtRefStart" class="form-control" type="datetime-local" title="Analisys: dataset start">
<label class="input-group-text" title="Analisys: dataset end">End</label>
<input @bind="@dtEnd" id="DtRefEnd" class="form-control" type="datetime-local" title="Analisys: dataset end">
<button class="btn btn-default btn-block " @onclick="toggleShowParams" title="Hide Parameters"><i class="fa-solid fa-ellipsis-vertical"></i></button>
</div>
}
else
{
<div class="input-group input-group-sm pt-1">
<button class="btn btn-default btn-block" @onclick="toggleShowParams" title="Show Parameters"><i class="fa-solid fa-ellipsis"></i></button>
</div>
}
</div>
</div>
+135
View File
@@ -0,0 +1,135 @@
using Microsoft.AspNetCore.Components;
using MP.MONO.UI.Data;
namespace MP.MONO.UI.Components
{
public partial class AlAnFilter
{
#region Public Properties
[Parameter]
public EventCallback<selectChartParams> FilterChanged { get; set; }
[Parameter]
public selectChartParams SelFilter { get; set; } = new selectChartParams();
#endregion Public Properties
#region Public Methods
#endregion Public Methods
#region Protected Fields
protected DateTime _dtEnd = DateTime.Now;
protected string FRCSSmode = "fw-bold";
protected string DUCSSmode = "text-secondary";
#endregion Protected Fields
#region Protected Properties
protected string currMode
{
get => setFreqDur ? "Frequency Mode" : "Duration Mode";
}
protected bool setFreqDur
{
get => SelFilter.setFreqDur;
set
{
if (SelFilter.setFreqDur != value)
{
SelFilter.setFreqDur = value;
reportChange();
}
}
}
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await FilterChanged.InvokeAsync(SelFilter);
}
protected async Task toggleRec()
{
var currFilt = SelFilter;
currFilt.setFreqDur = !currFilt.setFreqDur;
SelFilter = currFilt;
if (setFreqDur)
{
FRCSSmode = "fw-bold";
DUCSSmode = "text-secondary";
}
else
{
DUCSSmode = "fw-bold";
FRCSSmode = "text-secondary";
}
await Task.Delay(1);
reportChange();
}
#endregion Protected Methods
#region Private Properties
private DateTime dtEnd
{
get => SelFilter.dtMax;
set
{
if (SelFilter.dtMax != value)
{
// verifico coerenza
if (value <= dtStart)
{
value = dtStart.AddHours(1);
}
SelFilter.dtMax = value;
reportChange();
}
}
}
private DateTime dtStart
{
get => SelFilter.dtMin;
set
{
if (SelFilter.dtMin != value)
{
// verifico coerenza
if (value >= dtEnd)
{
value = dtEnd.AddHours(-1);
}
SelFilter.dtMin = value;
reportChange();
}
}
}
#endregion Private Properties
#region Private Methods
private void reportChange()
{
FilterChanged.InvokeAsync(SelFilter);
}
#endregion Private Methods
private bool showParams = false;
private void toggleShowParams()
{
showParams = !showParams;
}
}
}
@@ -6,31 +6,35 @@
@if (currRecord != null)
{
<div class="col-4">
<div class="col-12 pr-0">
@if (!string.IsNullOrEmpty(currRecord.CssIcon))
{
<div class="d-flex flex-column">
<div class="small"><sup>@currRecord.Title</sup></div>
<div class="small @cssLast(@currRecord.Title)"><sup>@currRecord.Title</sup></div>
<div><i class="@currRecord.CssIcon"></i></div>
</div>
}
else
{
<div>@currRecord.Title</div>
}
</div>
<div class="col-8 float-end">
<div class="d-flex flex-column">
<div class="d-flex flex-row-reverse"><h5 class="float-end"><b>@currRecord.Value</b></h5></div>
@if (currRecord.ShowBar)
{
<div class="w-100">
<div class="progress" style="height: 0.3rem;">
<div class="progress-bar" role="progressbar" style="@percProgress(currRecord.ValueNum, currRecord.MinVal, currRecord.MaxVal)" aria-valuenow="@currRecord.ValueNum" aria-valuemin="@currRecord.MinVal" aria-valuemax="@currRecord.MaxVal"></div>
<div class="d-flex justify-content-between">
<b><span class="@cssLast(@currRecord.Title) small">@currRecord.Title</span></b>
<div class="pl-0 float-end">
<div class="d-flex flex-column">
<div class="d-flex flex-row-reverse "><span class="float-end"><b>@currRecord.Value</b></span></div>
</div>
</div>
}
</div>
</div>
}
</div>
<div class="col-12">
@if (currRecord.ShowBar)
{
<div class="w-100">
<div class="progress" style="height: 0.3rem; width: 100%;">
<div class="progress-bar" role="progressbar" style="@percProgress(currRecord.ValueNum, currRecord.MinVal, currRecord.MaxVal)" aria-valuenow="@currRecord.ValueNum" aria-valuemin="@currRecord.MinVal" aria-valuemax="@currRecord.MaxVal"></div>
</div>
</div>
}
</div>
}
else
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using MP.MONO.Core.DTO;
using System.Diagnostics.Tracing;
namespace MP.MONO.UI.Components
{
@@ -9,6 +10,8 @@ namespace MP.MONO.UI.Components
[Parameter]
public DisplayDataDTO? currRecord { get; set; } = null;
[Parameter]
public List<string> SelVal { get; set; } = new List<string>();
#endregion Public Properties
@@ -19,7 +22,20 @@ namespace MP.MONO.UI.Components
string answ = "width: 0%;";
double den = (maxVal - minVal) != 0 ? (maxVal - minVal) : 1;
double ratio = ((double)num) / den;
answ = $"width: {ratio:P0};";
answ = $"width: {ratio:P0};";
return answ;
}
protected string cssLast(string toolName)
{
string answ = SelVal.Contains(toolName) ? "bg-dark text-light" : "";
// se è ultima testo giallo...
if (SelVal != null && SelVal.Count > 0)
{
if (SelVal.LastOrDefault().Equals(toolName))
{
answ = "bg-dark text-warning";
}
}
return answ;
}
+3 -3
View File
@@ -25,17 +25,17 @@ namespace MP.MONO.UI.Components
#region Private Properties
[Inject]
private IJSRuntime JSRuntime { get; set; }
private IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
private NavigationManager NavManager { get; set; }
private NavigationManager NavManager { get; set; } = null!;
#endregion Private Properties
#region Protected Properties
[Inject]
protected CurrentDataService DataService { get; set; }
protected CurrentDataService DataService { get; set; } = null!;
protected bool editAll
{
+56
View File
@@ -0,0 +1,56 @@
<div class="row">
<div class="col-12">
@if (ListRecordsDur == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Description</th>
<th>Total Duration <sub>(min)</sub></th>
<th>% Duration</th>
<th class="w-50">Chart</th>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecordsDur)
{
<tr>
<td>
<div>@item.AlarmDescription</div>
</td>
<td>
<div>@Math.Round(item.Duration,2)</div>
</td>
<td>
<div>
@if (totalVar != 0)
{
<span class="text-success">@calcPercDur((double)item.Duration)</span>
}
</div>
</td>
<td>
<div class="progress">
<div class="progress-bar @styleColourPBarDur((double)item.Duration/totalVar)" role="progressbar" style="@valDur((double)item.Duration)" aria-valuemin="0" aria-valuemax="100">@Math.Round(item.Duration,2)</div>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
</div>
</div>
@@ -0,0 +1,169 @@
using Microsoft.AspNetCore.Components;
using MP.MONO.Data.DTO;
using MP.MONO.UI.Data;
namespace MP.MONO.UI.Components
{
public partial class ListDurAlarms
{
#region Public Properties
[Parameter]
public selectChartParams selFilter { get; set; } = null!;
[Parameter]
public EventCallback<int> TotRecordChanged { get; set; }
#endregion Public Properties
#region Protected Properties
protected int currPage
{
get => selFilter.CurrPage;
}
protected DateTime dtEnd
{
get => selFilter.dtMax;
}
protected DateTime dtStart
{
get => selFilter.dtMin;
}
protected List<AlarmDurationDTO>? ListRecordsDur { get; set; } = null;
protected List<AlarmDurationDTO>? SearchRecordsDur { get; set; } = null;
protected double totalVar { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
#endregion Protected Methods
#region Private Fields
private double sogliaGreen = 0;
private double sogliaRed = 1;
#endregion Private Fields
#region Private Properties
private int _totalCount { get; set; } = 0;
private int numRecord
{
get => selFilter.NumRecord;
}
private int totalCount
{
get => _totalCount;
set
{
if (_totalCount != value)
{
_totalCount = value;
TotRecordChanged.InvokeAsync(value);
}
}
}
#endregion Private Properties
#region Private Methods
private void calcolaSoglieDur()
{
int numRecord = totalCount;
if (SearchRecordsDur != null)
{
var firstRecord = SearchRecordsDur.Skip((int)(numRecord * 0.2)).FirstOrDefault();
var lastRecord = SearchRecordsDur.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
{
sogliaGreen = (double)firstRecord.Duration / totalVar;
}
if (lastRecord != null)
{
sogliaRed = (double)lastRecord.Duration / totalVar;
}
}
}
protected string calcPercDur(double duration)
{
string ans = $"{duration / totalVar:P2}";
return ans;
}
private async Task ReloadData()
{
SearchRecordsDur = CurrentDataService.dbController.AlarmRecGetParetoDur(1, dtStart, dtEnd);
ListRecordsDur = SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsDur.Count;
totalVar = SearchRecordsDur.Sum(x => x.Duration);
//calcolaSoglieDur();
await Task.Delay(1);
}
protected string styleColourPBarDur(double duration)
{
string ans = "";
//var source = ListRecordsDur;
calcolaSoglieDur();
if (duration >= sogliaGreen)
{
ans = "bg-danger";
}
else if (duration <= sogliaRed)
{
ans = "bg-success";
}
else
{
ans = "bg-warning";
}
return ans;
}
protected string valDur(double duration)
{
string ans = "";
if (SearchRecordsDur != null)
{
double max = SearchRecordsDur.Max(a => a.Duration);
double divisione = duration / max;
int percentage = (int)(divisione * 100);
ans = $"width: {percentage}%";
}
return ans;
}
#endregion Private Methods
}
}
@@ -0,0 +1,52 @@
<div class="row">
<div class="col-12">
@if (ListRecordsFreq == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Description</th>
<th>Count</th>
<th>Frequency</th>
<th class="w-50">Chart</th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecordsFreq)
{
<tr>
<td>
<div>@record.AlarmDescription</div>
</td>
<td>
<div>@record.EventCount</div>
</td>
<td>
<div>
@if (totalVar != 0)
{
<span class="text-success">@calcPercFreq((double)record.EventCount)</span>
}
</div>
</td>
<td>
<div class="progress">
<div class="progress-bar @styleColourPBarFreq((double)record.EventCount/totalVar)" role="progressbar" style="@valFreq((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
</div>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
@@ -0,0 +1,163 @@
using Microsoft.AspNetCore.Components;
using MP.MONO.Data.DTO;
using MP.MONO.UI.Data;
namespace MP.MONO.UI.Components
{
public partial class ListFreqAlarms
{
#region Public Properties
[Parameter]
public selectChartParams selFilter { get; set; } = null!;
[Parameter]
public EventCallback<int> TotRecordChanged { get; set; }
#endregion Public Properties
#region Protected Properties
protected int currPage
{
get => selFilter.CurrPage;
}
protected DateTime dtEnd
{
get => selFilter.dtMax;
}
protected DateTime dtStart
{
get => selFilter.dtMin;
}
protected List<AlarmFreqDTO>? ListRecordsFreq { get; set; } = null;
protected List<AlarmFreqDTO>? SearchRecordsFreq { get; set; } = null;
protected int totalVar { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
#endregion Protected Methods
#region Private Fields
private double sogliaGreen = 0;
private double sogliaRed = 1;
#endregion Private Fields
#region Private Properties
private int _totalCount { get; set; } = 0;
private int numRecord
{
get => selFilter.NumRecord;
}
private int totalCount
{
get => _totalCount;
set
{
if (_totalCount != value)
{
_totalCount = value;
TotRecordChanged.InvokeAsync(value);
}
}
}
#endregion Private Properties
#region Private Methods
private void calcolaSoglieFreq()
{
int numRecord = totalCount;
if (SearchRecordsFreq != null)
{
var firstRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.2)).FirstOrDefault();
var lastRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
{
sogliaGreen = (double)firstRecord.EventCount / totalVar;
}
if (lastRecord != null)
{
sogliaRed = (double)lastRecord.EventCount / totalVar;
}
}
}
private string calcPercFreq(double numEvent)
{
string ans = $"{numEvent / totalVar:P2}";
return ans;
}
private async Task ReloadData()
{
SearchRecordsFreq = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, dtStart, dtEnd);
ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsFreq.Count;
totalVar = SearchRecordsFreq.Sum(x => x.EventCount);
calcolaSoglieFreq();
await Task.Delay(1);
}
private string styleColourPBarFreq(double eventFreq)
{
string ans = "";
var source = ListRecordsFreq;
calcolaSoglieFreq();
if (eventFreq >= sogliaGreen)
{
ans = "bg-danger";
}
else if (eventFreq <= sogliaRed)
{
ans = "bg-success";
}
else
{
ans = "bg-warning";
}
return ans;
}
private string valFreq(double eventCount)
{
string ans = "";
if (SearchRecordsFreq != null)
{
int max = SearchRecordsFreq.Max(a => a.EventCount);
double divisione = eventCount / max;
int percentage = (int)(divisione * 100);
ans = $"width: {percentage}%";
}
return ans;
}
#endregion Private Methods
}
}
+66 -24
View File
@@ -7,37 +7,55 @@
@inject IConfiguration Configuration;
<div class="card">
<div class="card mb-5">
@if (!compMode)
{
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="p-0">
<div class="d-flex">
<div class="px-2">
<button class="btn btn-primary btn-sm" @onclick="() => ChangeMode()" title="Show Scheduled"><i class="bi bi-gear-fill"></i></button>
</div>
<div class="p-0">
<h5>Maintenance's Task: Pending <i class="bi bi-list-check"></i></h5>
<div class="d-flex justify-content-between col-12">
<div class="p-0 pt-1">
<div class="d-flex justify-content-between ">
<div class="pb-1 d-flex justify-content-between">
<h5 class="pt-2 mx-2">Maintenance's Pending Task</h5>
<div class="pb-1 d-flex justify-content-between">
<div class="input-group">
<button class="btn btn-primary btn-sm" id="btnShow" @onclick="() => ChangeMode()"><i class="fa-regular fa-circle-right"></i></button>
<button class="btn btn-primary btn-sm" id="btnInfo" title="Scheduled tasks" disabled>
Click to configure Schedule
</button>
</div>
</div>
</div>
</div>
</div>
<div class="px-2">
<div class="input-group">
<span class="input-group-text" title="Limit visualization to event expirying in the next hour period">Limit Period</span>
<select @bind="@LimitDayPeriod" class="form-select form-select text-end">
<option value="7">1 Week</option>
<option value="30">1 Month</option>
<option value="365">1 Year</option>
<option value="0">All (no limit)</option>
</select>
<button class="btn btn-primary" @onclick="() => RegenTask()">Reschedule <i class="bi bi-tools"></i></button>
<div class="d-flex justify-content-between pt-0 ">
@if (showParams)
{
<div class="input-group pt-0 ">
<span class="input-group-text" title="Limit visualization to event expirying in the next hour period">Limit Period</span>
<select @bind="@LimitDayPeriod" class="form-select form-select text-end">
<option value="7">1 Week</option>
<option value="30">1 Month</option>
<option value="365">1 Year</option>
<option value="0">All (no limit)</option>
</select>
<button class="btn btn-primary" @onclick="() => RegenTask()">Reschedule <i class="bi bi-tools"></i></button>
<button class="btn btn-default btn-block" @onclick="toggleShowParams" title="Show Parameters"><i class="fa-solid fa-ellipsis-vertical"></i></button>
</div>
}
else
{
<div class="input-group input-group-sm pt-1">
<button class="btn btn-default btn-block" @onclick="toggleShowParams" title="Show Parameters"><i class="fa-solid fa-ellipsis"></i></button>
</div>
}
</div>
</div>
</div>
</div>
}
<div class="card-body">
<div class="card-body @bodyCss">
@if (ListRecords == null)
{
<LoadingData></LoadingData>
@@ -94,16 +112,16 @@
<table class="table table-sm table-striped table-responsive-lg small">
<thead>
<tr>
<th>ID</th>
@if (!compMode)
{
<th>ID</th>
<th>Created</th>
<th>Topic</th>
<th>Machine Group</th>
<th>Team in Charge</th>
<th>Counter Var</th>
<th>Rem. Hours</th>
}
<th>Rem. Hours</th>
<th>Job Description</th>
@if (!compMode)
{
@@ -115,17 +133,25 @@
@foreach (var record in ListRecords)
{
<tr>
<td>@record.PMTaskeNav.ExtIdx</td>
@if (!compMode)
{
<td>@record.PMTaskeNav.ExtIdx</td>
<td>@record.DtCreation.ToString("yyyy-MM-dd HH:mm:ss")</td>
<td>@record.PMTaskeNav.TopicNav.Description</td>
<td>@record.PMTaskeNav.MachGroupNav.Description</td>
<td>@record.PMTaskeNav.UserTeamNav.Description</td>
<td>@record.CounterNav.Description</td>
<td style="width: 8rem;"><ProgBar currVal="@record.CountRemainVal" maxVal="@record.ExpiryVal" redLim="@redLim" yelLim="@yelLim"></ProgBar></td>
<td>@record.PMTaskeNav.JobDescription</td>
}
else
{
@*<td class="text-center"><b>@($"{record.CountRemainVal:N0}")</b></td>*@
<td class="small textConsensed">
<div>@record.PMTaskeNav.JobDescription</div>
<ProgBar currVal="@record.CountRemainVal" maxVal="@record.ExpiryVal" redLim="@redLim" yelLim="@yelLim" singleLine="true"></ProgBar>
</td>
}
<td style="width: 8rem;"><ProgBar currVal="@record.CountRemainVal" maxVal="@record.ExpiryVal" redLim="@redLim" yelLim="@yelLim"></ProgBar></td>
<td>@record.PMTaskeNav.JobDescription</td>
@if (!compMode)
{
<td>
@@ -149,5 +175,21 @@
}
</div>
<style>
#btnInfo {
opacity: 0.0;
-webkit-transition: all 500ms ease-in-out;
-moz-transition: all 500ms ease-in-out;
-ms-transition: all 500ms ease-in-out;
-o-transition: all 500ms ease-in-out;
transition: all 500ms ease-in-out;
}
#btnShow:hover + #btnInfo {
opacity: 1.0;
}
</style>
@@ -54,6 +54,18 @@ namespace MP.MONO.UI.Components
[Parameter]
public EventCallback<bool> reqChangeMode { get; set; }
private bool doSetup = true;
protected string currMode
{
get => doSetup ? "Pending" : "Scheduled";
}
protected string bodyCss
{
get => compMode ? "p-1" : "";
}
#endregion Public Properties
#region Private Properties
@@ -250,5 +262,11 @@ namespace MP.MONO.UI.Components
}
#endregion Private Methods
private bool showParams = false;
private void toggleShowParams()
{
showParams = !showParams;
}
}
}
+122 -101
View File
@@ -7,30 +7,38 @@
@inject IJSRuntime JSRuntime
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="px-2">
<div class="d-flex">
<div class="px-2">
<button class="btn btn-primary btn-sm" @onclick="() => ChangeMode()" title="Show Pending"><i class="bi bi-list-check"></i></button>
</div>
<div class="p-0">
<h5>Maintenance's Task: Scheduled <i class="bi bi-gear-fill"></i></h5>
<div class="card mb-5">
<div class="card-header bg-primary text-light">
<div class="d-flex justify-content-between col-12">
<div class="p-0 pt-1 col-6">
<div class="d-flex justify-content-between">
<div class="d-flex justify-content-between">
<h5 class="pt-2 mx-2">Maintenance's Task Setup</h5>
<div class="pb-1 d-flex justify-content-between">
<div class="input-group">
<button class="btn btn-light btn-sm" id="btnShow" @onclick="() => ChangeMode()"><i class="fa-regular fa-circle-right"></i></button>
<button class="btn btn-light btn-sm" id="btnInfo" title="Scheduled tasks" disabled>
Click to return to pending Tasks
</button>
</div>
</div>
</div>
</div>
</div>
<div class="px-2">
<button class="btn btn-success btn-sm" @onclick="() => toggleAddNew()" title="@addNewMessage">
@if (showAddNew)
{
<i class="bi bi-caret-up-square"></i>
}
else
{
<i class="bi bi-caret-down-square"></i>
}
</button>
<div class="input-group py-1">
<button class="btn btn-success btn-sm" @onclick="() => toggleAddNew()" title="@addNewMessage">
@addNewMessage
@if (showAddNew)
{
<i class="bi bi-caret-up-square"></i>
}
else
{
<i class="bi bi-caret-down-square"></i>
}
</button>
</div>
</div>
</div>
</div>
@@ -45,99 +53,112 @@
}
else
{
@if (showAddNew)
@if (showAddNew || showEdit)
{
<EditMaintTask currItem="@currRec" DataReset="() => ResetData()" DataUpdated="() => UpdateActivData()"></EditMaintTask>
}
else
{
<div class="d-flex">
<div class="@mainCssClass">
<table class="table table-sm table-striped table-responsive-lg small">
<thead>
<tr>
<th></th>
<th>ID</th>
@if (currPMTaskId == 0)
{
<th>Topic</th>
<th>Machine Group</th>
<th>Team in Charge</th>
<th>Counter Var</th>
<th>Expyre (H)</th>
}
<th>Job Description</th>
@if (currPMTaskId == 0)
{
<th class="text-end"># Exec</th>
<th></th>
<th></th>
}
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
<div class="d-flex">
<div class="@mainCssClass">
<table class="table table-sm table-striped table-responsive-lg small">
<thead>
<tr>
<th></th>
<th>ID</th>
@if (currPMTaskId == 0)
{
<tr class="@cssCheckSel(record.PMTaskId) @cssCheckDisabled(record.IsDisabled)">
<th>Topic</th>
<th>Machine Group</th>
<th>Team in Charge</th>
<th>Counter Var</th>
<th>Expyre (H)</th>
}
<th>Job Description</th>
@if (currPMTaskId == 0)
{
<th class="text-end"># Exec</th>
<th></th>
}
<th></th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
<tr class="@cssCheckSel(record.PMTaskId) @cssCheckDisabled(record.IsDisabled)">
<td>
@if (!record.IsDisabled)
{
<button class="btn btn-primary btn-sm" @onclick="() => EditRecord(record)" title="Edit"><i class="bi bi-pencil"></i></button>
}
</td>
<td class="text-nowrap">
@record.ExtIdx
</td>
@if (currPMTaskId == 0)
{
<td>@record.TopicNav.Description</td>
<td>@record.MachGroupNav.Description</td>
<td>@record.UserTeamNav.Description</td>
<td>@record.CounterNav.Description</td>
<td>@record.ExpiryVal</td>
}
<td>@record.JobDescription</td>
@if (currPMTaskId == 0)
{
<td class="text-end">@record.NumTaskDone</td>
}
<td>
@if (record.NumTaskDone > 0)
{
<button class="btn btn-success btn-sm" @onclick="() => ShowDetail(record)" title="Show History"><i class="bi bi-clock-history"></i></button>
}
</td>
@if (currPMTaskId == 0)
{
<td>
@if (!record.IsDisabled)
{
<button class="btn btn-primary btn-sm" @onclick="() => EditRecord(record)" title="Edit"><i class="bi bi-pencil"></i></button>
<button class="btn btn-danger btn-sm" @onclick="() => DeleteRecord(record)" title="Delete/Disable Task"><i class="bi bi-trash"></i></button>
}
else
{
<button class="btn btn-warning btn-sm" @onclick="() => EnableRecord(record)" title="Re-enable Task"><i class="bi bi-check"></i></button>
}
</td>
<td class="text-nowrap">
@record.ExtIdx
</td>
@if (currPMTaskId == 0)
{
<td>@record.TopicNav.Description</td>
<td>@record.MachGroupNav.Description</td>
<td>@record.UserTeamNav.Description</td>
<td>@record.CounterNav.Description</td>
<td>@record.ExpiryVal</td>
}
<td>@record.JobDescription</td>
@if (currPMTaskId == 0)
{
<td class="text-end">@record.NumTaskDone</td>
<td>
@if (record.NumTaskDone > 0)
{
<button class="btn btn-success btn-sm" @onclick="() => ShowDetail(record)" title="Show History"><i class="bi bi-clock-history"></i></button>
}
</td>
<td>
@if (!record.IsDisabled)
{
<button class="btn btn-danger btn-sm" @onclick="() => DeleteRecord(record)" title="Delete/Disable Task"><i class="bi bi-trash"></i></button>
}
else
{ <button class="btn btn-warning btn-sm" @onclick="() => EnableRecord(record)" title="Re-enable Task"><i class="bi bi-check"></i></button>
}
</td>
}
</tr>
}
</tbody>
</table>
</div>
@if (currPMTaskId > 0)
{
<div class="px-2 flex-grow-1 small">
<MaintTaskExecHist currPMTaskId="@currPMTaskId" reqClose="() => ShowDetail(null)" currParentRec="@selRecord"></MaintTaskExecHist>
</div>
}
}
</tr>
}
</tbody>
</table>
</div>
}
@if (currPMTaskId > 0)
{
<div class="p-2 flex-grow-1 small selBlock">
<MaintTaskExecHist currPMTaskId="@currPMTaskId" reqClose="() => ShowDetail(null)" currParentRec="@selRecord"></MaintTaskExecHist>
</div>
}
</div>
}
</div>
@if (!showAddNew)
{
<div class="card-footer py-0">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
}
<div class="card-footer py-0">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
<style>
#btnInfo {
opacity: 0.0;
-webkit-transition: all 500ms ease-in-out;
-moz-transition: all 500ms ease-in-out;
-ms-transition: all 500ms ease-in-out;
-o-transition: all 500ms ease-in-out;
transition: all 500ms ease-in-out;
}
#btnShow:hover + #btnInfo {
opacity: 1.0;
}
</style>
+31 -5
View File
@@ -23,6 +23,7 @@ namespace MP.MONO.UI.Components
protected async Task ResetData()
{
showAddNew = false;
showEdit = false;
currRec = null;
await ReloadData();
}
@@ -51,6 +52,8 @@ namespace MP.MONO.UI.Components
private List<PrevMaintTaskModel>? SearchRecords = null;
private bool showParams = false;
#endregion Private Fields
#region Private Properties
@@ -61,7 +64,7 @@ namespace MP.MONO.UI.Components
private string addNewMessage
{
get => showAddNew ? "Hide Add New Task" : "Show Add new Task";
get => showAddNew ? "Hide Add New Task " : "Show Add new Task ";
}
private int currPage
@@ -80,12 +83,13 @@ namespace MP.MONO.UI.Components
}
private int currPMTaskId { get; set; } = 0;
private int currPMTaskIdMod { get; set; } = 0;
private bool isLoading { get; set; } = false;
private string mainCssClass
{
get => currPMTaskId == 0 ? "px-2 flex-fill" : "px-2 flex-grow-0";
get => currPMTaskId == 0 ? "px-0 flex-fill" : "px-0 flex-grow-0";
}
private int MaxRecord
@@ -123,6 +127,7 @@ namespace MP.MONO.UI.Components
private PrevMaintTaskModel? selRecord { get; set; } = null;
private bool showAddNew { get; set; } = false;
private bool showEdit { get; set; } = false;
private int totalCount
{
@@ -156,7 +161,23 @@ namespace MP.MONO.UI.Components
private string cssCheckSel(int PMTaskId)
{
return PMTaskId == currPMTaskId ? "table-primary" : "";
string ans = "";
if ((PMTaskId == currPMTaskId) || (PMTaskId == currPMTaskIdMod))
{
ans = "table-primary";
}
else
{
ans = "";
}
return ans;
}
private string cssCheckSelMod(int PMTaskId)
{
return PMTaskId == currPMTaskIdMod ? "table-primary" : "";
}
/// <summary>
@@ -203,8 +224,11 @@ namespace MP.MONO.UI.Components
private async Task EditRecord(PrevMaintTaskModel cRec)
{
currRec = cRec;
showAddNew = true;
currPMTaskIdMod = cRec.PMTaskId;
currPMTaskId = 0;
//showAddNew = true;
await Task.Delay(1);
showEdit = true;
}
/// <summary>
@@ -255,6 +279,7 @@ namespace MP.MONO.UI.Components
if (currRec != null)
{
currPMTaskId = currRec.PMTaskId;
currPMTaskIdMod = 0;
}
else
{
@@ -270,8 +295,9 @@ namespace MP.MONO.UI.Components
private void toggleAddNew()
{
showAddNew = !showAddNew;
showEdit = !showEdit;
// se mostro --> creo nuovo record...
if (showAddNew)
if (showEdit)
{
currRec = new PrevMaintTaskModel();
}
+22 -13
View File
@@ -10,13 +10,12 @@
@foreach (var item in ListRecords)
{
<li class="list-group-item list-group-item-action @cssActive(item.Title)" @onclick="() => toggleSelect(item.Title)">
<div class="row" title="click to show graph">
<div class="col-5 pr-0">
<div class="row" title="click to plot">
<div class="col-6 pr-0">
@if (!string.IsNullOrEmpty(item.CssIcon))
{
<div class="d-flex flex-column">
<div class="small @cssLast(item.Title)"><sup>@item.Title</sup></div>
<div><i class="@item.CssIcon"></i></div>
<div class="small @cssLast(item.Title)"><b>@item.Title</b></div>
</div>
}
else
@@ -24,19 +23,29 @@
<div>@item.Title</div>
}
</div>
<div class="col-7 pl-0 float-end">
<div class="col-6 pl-0 float-end">
<div class="d-flex flex-column">
<div class="d-flex flex-row-reverse"><h5 class="float-end"><b>@item.Value</b></h5></div>
@if (item.ShowBar)
{
<div class="w-100">
<div class="progress" style="height: 0.3rem;">
<div class="progress-bar" role="progressbar" style="@percProgress(item.ValueNum, item.MinVal, item.MaxVal)" aria-valuenow="@item.ValueNum" aria-valuemin="@item.MinVal" aria-valuemax="@item.MaxVal"></div>
</div>
<div class="d-flex flex-row-reverse">
<div>
<span class="@item.CssIcon"></span>
</div>
}
&nbsp;
<div>
<span class="float-end"><b>@item.Value</b></span>
</div>
</div>
</div>
</div>
<div class="col-12">
@if (item.ShowBar)
{
<div class="w-100">
<div class="progress" style="height: 0.3rem;">
<div class="progress-bar" role="progressbar" style="@percProgress(item.ValueNum, item.MinVal, item.MaxVal)" aria-valuenow="@item.ValueNum" aria-valuemin="@item.MinVal" aria-valuemax="@item.MaxVal"></div>
</div>
</div>
}
</div>
</div>
</li>
}
+2 -1
View File
@@ -2,6 +2,7 @@
using MP.MONO.Data;
using MP.MONO.Data.DTO;
using MP.MONO.UI.Data;
using static MP.MONO.Core.Enums;
namespace MP.MONO.UI.Components
{
@@ -118,7 +119,7 @@ namespace MP.MONO.UI.Components
isLoading = true;
ListRecords = null;
await Task.Delay(1);
ListRecords = await MMDataService.DataLogDtoGetFilt(MachineId, SelectedParam, StartDate, EndDate);
ListRecords = await MMDataService.DataLogDtoGetFilt(MachineId, DataLogType.Parameter, SelectedParam, StartDate, EndDate);
await Task.Delay(1);
// converto in plotdata
LevelVal = ListRecords.Select(l => new chartJsData.chartJsTSerie() { x = l.DtRif, y = l.ValNum }).ToList();
+15 -6
View File
@@ -1,8 +1,17 @@
<div class="text-center @textStyle">
<span class="@warnClass"><i class="bi bi-exclamation-triangle-fill"></i></span> <b>@currVal.ToString("N0")</b> <span class="@warnClass"><i class="bi bi-exclamation-triangle-fill"></i></span>
</div>
<div class="progress">
<div class="progress-bar @bgStyle" style="width:@(percWidth)%">@(percWidth)%</div>
</div>
@if (singleLine)
{
<div class="progress">
<div class="progress-bar @bgStyle" style="width:@(percWidth)%">@($"{currVal:N0} h | {percWidth}%")</div>
</div>
}
else
{
<div class="text-center @textStyle">
<span class="@warnClass"><i class="bi bi-exclamation-triangle-fill"></i></span> <b>@currVal.ToString("N0")</b> <span class="@warnClass"><i class="bi bi-exclamation-triangle-fill"></i></span>
</div>
<div class="progress">
<div class="progress-bar @bgStyle" style="width:@(percWidth)%">@(percWidth)%</div>
</div>
}
+4
View File
@@ -18,6 +18,10 @@ namespace MP.MONO.UI.Components
[Parameter]
public int yelLim { get; set; } = 20;
[Parameter]
public bool singleLine { get; set; } = false;
#endregion Public Properties
#region Private Properties
+2 -3
View File
@@ -38,12 +38,11 @@
</div>
</li>*@
<li class="list-group-item list-group-item-action">
<DisplayRecordComponent currRecord="@item"></DisplayRecordComponent>
<li class="list-group-item list-group-item-action @cssActive(item.Title)" @onclick="()=>toggleSelect(item.Title)">
<DisplayRecordComponent selVal="@SelVal" currRecord="@item"></DisplayRecordComponent>
</li>
}
</ul>
@*<DetailOverview></DetailOverview>*@
}
else
{
+118 -37
View File
@@ -1,53 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP.MONO.UI;
using MP.MONO.UI.Shared;
using MP.MONO.UI.Components;
using MP.MONO.Core.DTO;
using MP.MONO.UI.Data;
using Newtonsoft.Json;
using MP.MONO.Data;
using Newtonsoft.Json;
namespace MP.MONO.UI.Components
{
public partial class ToolsOverview
{
private List<DisplayDataDTO>? ListRecords { get; set; } = null;
#region Public Properties
[Parameter]
public bool ShowReduced { get; set; } = false;
[Parameter]
public EventCallback<string> EC_AddValue { get; set; }
[Parameter]
public EventCallback<string> EC_RemValue { get; set; }
[Parameter]
public bool selectAll { get; set; } = false;
[Parameter]
public List<string> SelVal { get; set; } = new List<string>();
#endregion Public Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await ReloadData();
MMDataService.toolsPipe.EA_NewMessage += ToolsPipe_EA_NewMessage;
}
private void ToolsPipe_EA_NewMessage(object? sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
try
{
ListRecords = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(currArgs.newMessage);
}
catch
{ }
}
InvokeAsync(() =>
{
StateHasChanged();
});
}
protected string percProgress(double num, double minVal, double maxVal)
{
string answ = "width: 0%;";
@@ -56,9 +41,105 @@ namespace MP.MONO.UI.Components
answ = $"width: {ratio:P0};";
return answ;
}
protected async Task ReloadData()
{
ListRecords = await MMDataService.getTools();
SelVal = new List<string>();
var allData = await MMDataService.getTools();
// se modalità reduced --> mostro solo il subset dati filtrati...
FilterData(allData);
}
private void FilterData(List<DisplayDataDTO> allData)
{
if (ShowReduced)
{
ListRecords = allData
.Where(x => x.HLShow)
.OrderBy(x => x.Order)
.ToList();
}
else
{
ListRecords = allData
.OrderBy(x => x.Order)
.ToList();
}
}
protected string cssLast(string toolName)
{
string answ = SelVal.Contains(toolName) ? "bg-dark text-light" : "";
// se è ultima testo giallo...
if (SelVal != null && SelVal.Count > 0)
{
if (SelVal.LastOrDefault().Equals(toolName))
{
answ = "bg-dark text-warning";
}
}
return answ;
}
protected string cssActive(string toolName)
{
string answ = SelVal.Contains(toolName) ? "bg-dark text-light" : "";
return answ;
}
protected void toggleSelect(string SelectedValue)
{
// se contiene rimuovo
if (SelVal.Contains(SelectedValue))
{
//SelVal.Remove(SelectedValue);
EC_RemValue.InvokeAsync(SelectedValue);
}
// altrimenti aggiungo
else
{
//SelVal.Add(SelectedValue);
EC_AddValue.InvokeAsync(SelectedValue);
}
}
protected void toggleSelectAll()
{
if (selectAll == true && ListRecords != null)
{
foreach (var item in ListRecords)
{
EC_AddValue.InvokeAsync(item.Title);
}
}
}
#endregion Protected Methods
#region Private Properties
private List<DisplayDataDTO>? ListRecords { get; set; } = null;
#endregion Private Properties
#region Private Methods
private void ToolsPipe_EA_NewMessage(object? sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
try
{
var rawData = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(currArgs.newMessage);
var allData = rawData == null ? new List<DisplayDataDTO>() : rawData;
FilterData(allData);
}
catch
{ }
}
InvokeAsync(() =>
{
StateHasChanged();
});
}
#endregion Private Methods
}
}
+29
View File
@@ -0,0 +1,29 @@
@using MP.MONO.UI.Components
@using MP.MONO.Core.DTO
@using MP.MONO.UI.Data
@using Microsoft.Extensions.Configuration;
@inject IConfiguration Configuration;
@inject CurrentDataService MMDataService
@if (!string.IsNullOrEmpty(@SelectedTool))
{
<div class="d-flex justify-content-between mb-2">
<div class="px-1 border border-info rounded">
<i class="fa-solid fa-tower-broadcast"></i> <b>@SelectedTool</b>
</div>
</div>
<div class="d-flex">
<div class="px-1 flex-fill">
@if (LevelVal == null || LevelVal.Count == 0)
{
<LoadingDataSmall></LoadingDataSmall>
}
else
{
<MP.MONO.UI.Components.Chart.Line ChartId="@ToolId" AspRatio="4" DataTS="@LevelVal" lineColor="@getLineColors("0.75")" backColor="@getFillColors("0.25")" pointColor="@getPointColors("1")" lTens="0" MinValue="@MinVal" MaxValue="@MaxVal"></MP.MONO.UI.Components.Chart.Line>
}
</div>
</div>
}
+156
View File
@@ -0,0 +1,156 @@
using Microsoft.AspNetCore.Components;
using MP.MONO.Core.DTO;
using MP.MONO.Data;
using MP.MONO.Data.DTO;
using MP.MONO.UI.Data;
using Newtonsoft.Json;
using static MP.MONO.Core.Enums;
namespace MP.MONO.UI.Components
{
public partial class ToolsPlot
{
#region Public Properties
[Parameter]
public int MachineId { get; set; } = 1;
public string ToolId
{
get => _selTool.Replace(" ", "_");
}
[Parameter]
public string SelectedTool
{
get => _selTool;
set => _selTool = value;
}
[Parameter]
public DataLogFilter SelFilter
{
get => _SelFilter;
set { _SelFilter = value; }
}
#endregion Public Properties
#region Protected Fields
protected DateTime lastRec = DateTime.Now.AddMinutes(-1);
protected List<chartJsData.chartJsTSerie> LevelVal = new List<chartJsData.chartJsTSerie>();
protected Dictionary<string, string> listMaxVal = new Dictionary<string, string>();
protected Dictionary<string, string> listMinVal = new Dictionary<string, string>();
#endregion Protected Fields
#region Protected Properties
protected DataLogFilter _SelFilter { get; set; } = new DataLogFilter();
protected string _selTool { get; set; } = "";
protected string? MaxVal
{
get
{
string answ = "0";
if (listMaxVal != null && listMaxVal.Count > 0)
{
answ = listMaxVal[SelectedTool] ?? "0";
}
return answ;
}
}
protected string? MinVal
{
get
{
string answ = "0";
if (listMinVal != null && listMinVal.Count > 0)
{
answ = listMinVal[SelectedTool] ?? "0";
}
return answ;
}
}
#endregion Protected Properties
#region Protected Methods
protected List<string> getFillColors(string alpha)
{
List<string> answ = new List<string>();
answ.Add($"rgba(108, 214, 164, {alpha})");
return answ;
}
protected List<string> getLineColors(string alpha)
{
List<string> answ = new List<string>();
answ.Add($"rgba(54, 204, 82, {alpha})");
return answ;
}
protected List<string> getPointColors(string alpha)
{
List<string> answ = new List<string>();
answ.Add($"rgba(108, 158, 118, {alpha})");
return answ;
}
protected override async Task OnInitializedAsync()
{
await ReloadData();
await Task.Delay(1);
}
protected override async Task OnParametersSetAsync()
{
isLoading = true;
await ReloadData();
await Task.Delay(1);
}
protected async Task ReloadData()
{
isLoading = true;
ListRecords = null;
await Task.Delay(1);
ListRecords = await MMDataService.DataLogDtoGetFilt(MachineId, DataLogType.Tools, SelectedTool, StartDate, EndDate);
await Task.Delay(1);
// converto in plotdata
LevelVal = ListRecords.Select(l => new chartJsData.chartJsTSerie() { x = l.DtRif, y = l.ValNum }).ToList();
await Task.Delay(1);
isLoading = false;
}
#endregion Protected Methods
#region Private Fields
private List<DataLogDTO>? ListRecords = null;
#endregion Private Fields
#region Private Properties
private DateTime EndDate
{
get => _SelFilter.DtEnd;
}
private bool isLoading { get; set; } = false;
private DateTime StartDate
{
get => _SelFilter.DtStart;
}
#endregion Private Properties
}
}
+29
View File
@@ -0,0 +1,29 @@
@using MP.MONO.UI.Components
@using MP.MONO.Core.DTO
@using MP.MONO.UI.Data
@using Microsoft.Extensions.Configuration;
@inject IConfiguration Configuration;
@inject CurrentDataService MMDataService
@if (!string.IsNullOrEmpty(@SelectedTool))
{
<div class="d-flex justify-content-between mb-2">
<div class="px-1 border border-info rounded">
<i class="fa-solid fa-tower-broadcast"></i> <b>@SelectedTool</b>
</div>
</div>
<div class="d-flex">
<div class="px-1 flex-fill">
@if (LevelVal == null || LevelVal.Count == 0)
{
<LoadingDataSmall></LoadingDataSmall>
}
else
{
<MP.MONO.UI.Components.Chart.Line ChartId="@ToolId" AspRatio="4" DataTS="@LevelVal" lineColor="@getLineColors("0.75")" backColor="@getFillColors("0.25")" pointColor="@getPointColors("1")" lTens="0" MinValue="@MinVal" MaxValue="@MaxVal"></MP.MONO.UI.Components.Chart.Line>
}
</div>
</div>
}
+213
View File
@@ -0,0 +1,213 @@
using Microsoft.AspNetCore.Components;
using MP.MONO.Core.DTO;
using MP.MONO.Data;
using Newtonsoft.Json;
namespace MP.MONO.UI.Components
{
public partial class ToolsPlotRT
{
#region Protected Fields
protected DateTime lastRec = DateTime.Now.AddMinutes(-1);
protected Dictionary<string, string> listMaxVal = new Dictionary<string, string>();
protected Dictionary<string, string> listMinVal = new Dictionary<string, string>();
protected Dictionary<string, List<chartJsData.chartJsTSerie>> plotData = new Dictionary<string, List<chartJsData.chartJsTSerie>>();
#endregion Protected Fields
#region Protected Properties
protected string _selTool { get; set; } = "";
protected List<chartJsData.chartJsTSerie> LevelVal
{
get
{
List<chartJsData.chartJsTSerie> answ = new List<chartJsData.chartJsTSerie>();
if (plotData.ContainsKey(SelectedTool))
{
answ = plotData[SelectedTool];
}
return answ;
}
}
protected string? MaxVal
{
get
{
string answ = "0";
if (listMaxVal != null && listMaxVal.Count > 0)
{
answ = listMaxVal[SelectedTool] ?? "0";
}
return answ;
}
}
protected string? MinVal
{
get
{
string answ = "0";
if (listMinVal != null && listMinVal.Count > 0)
{
answ = listMinVal[SelectedTool] ?? "0";
}
return answ;
}
}
#endregion Protected Properties
#region Public Properties
[Parameter]
public int maxRecord { get; set; } = 120;
public string ToolId
{
get => _selTool.Replace(" ", "_");
}
[Parameter]
public double sampleSecMin { get; set; } = 1;
[Parameter]
public string SelectedTool
{
get
{
return _selTool;
}
set
{
// controllo se è variato
if (_selTool != value)
{
// salvo
_selTool = value;
// cerco se ho in dictionary...
if (!plotData.ContainsKey(value))
{
DateTime adesso = DateTime.Now;
// creo un oggetto della lunghezza desiderata...
var emptyData = new List<chartJsData.chartJsTSerie>();
for (int i = -maxRecord; i < 0; i++)
{
emptyData.Add(new chartJsData.chartJsTSerie() { x = adesso.AddSeconds(i), y = 0 });
}
plotData.Add(value, emptyData);
}
}
}
}
#endregion Public Properties
#region Private Methods
//private int inputValue = 123;
private void ToolsPipe_EA_NewMessage(object? sender, EventArgs e)
{
DateTime adesso = DateTime.Now;
if (lastRec.AddSeconds(sampleSecMin) < adesso)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
try
{
var ListRecords = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(currArgs.newMessage);
// prendo SOLO il dato della TS richiesta
if (ListRecords != null)
{
// accodo in blocco tutti i valori...
foreach (var item in ListRecords)
{
// cerco se ci sono min/max del valore indicato...
if (!listMinVal.ContainsKey(item.Title))
{
listMinVal.Add(item.Title, $"{item.MinVal:N0}");
}
if (!listMaxVal.ContainsKey(item.Title))
{
listMaxVal.Add(item.Title, $"{item.MaxVal:N0}");
}
// verifico dictionary se mancasse...
if (!plotData.ContainsKey(item.Title))
{
//plotData.Add(item.Title, new List<chartJsData.chartJsTSerie>());
// creo un oggetto della lunghezza desiderata...
var emptyData = new List<chartJsData.chartJsTSerie>();
for (int i = -maxRecord; i < 0; i++)
{
emptyData.Add(new chartJsData.chartJsTSerie() { x = adesso.AddSeconds(i), y = 0 });
}
plotData.Add(item.Title, emptyData);
}
// ora accodo il valore
if (plotData.ContainsKey(item.Title))
{
plotData[item.Title].Add(new chartJsData.chartJsTSerie() { x = adesso, y = item.ValueNum });
// verifico limite visualizzazione
if (plotData[item.Title].Count > maxRecord)
{
plotData[item.Title].RemoveRange(0, plotData[item.Title].Count - maxRecord);
}
}
}
}
}
catch
{ }
}
lastRec = adesso;
}
InvokeAsync(() =>
{
StateHasChanged();
});
}
#endregion Private Methods
#region Protected Methods
protected List<string> getFillColors(string alpha)
{
List<string> answ = new List<string>();
answ.Add($"rgba(108, 164, 254, {alpha})");
return answ;
}
protected List<string> getLineColors(string alpha)
{
List<string> answ = new List<string>();
answ.Add($"rgba(54, 82, 254, {alpha})");
return answ;
}
protected List<string> getPointColors(string alpha)
{
List<string> answ = new List<string>();
answ.Add($"rgba(108, 118, 158, {alpha})");
return answ;
}
protected override async Task OnInitializedAsync()
{
//await ReloadData();
await Task.Delay(1);
MMDataService.toolsPipe.EA_NewMessage += ToolsPipe_EA_NewMessage;
}
#endregion Protected Methods
}
}
+71 -9
View File
@@ -105,7 +105,14 @@ namespace MP.MONO.UI.Data
Log.Trace($"Effettuata lettura da DB AlarmListInsert: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
/// <summary>
/// restituisce lista di allarmi (ultimi dati "skip")
/// </summary>
/// </summary>
/// <param name="machineId"></param>
/// <param name="skipRec"></param>
/// <param name="numRec"></param>
/// <returns></returns>
public async Task<List<AlarmLogModel>> AlarmLogGetFilt(int machineId, int skipRec, int numRec)
{
Stopwatch stopWatch = new Stopwatch();
@@ -116,6 +123,24 @@ namespace MP.MONO.UI.Data
Log.Trace($"Effettuata lettura da DB AlarmLogGetFilt: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
/// <summary>
/// Recupero elenco allarmi con data <= alla data di riferimento (ultimi dati "skip")
/// </summary>
/// <param name="machineId"></param>
/// <param name="dtRif"></param>
/// <param name="skipRec"></param>
/// <param name="numRec"></param>
/// <returns></returns>
public async Task<List<AlarmLogModel>> AlarmLogGetFiltByDate(int machineId, DateTime dtRif, int skipRec, int numRec)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
var dbResult = dbController.AlarmLogGetFiltByDate(machineId, dtRif, skipRec, numRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB AlarmLogGetFilt: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
/// <summary>
/// Chiude ultimo record dato Id (se fossero + di 1 chiude tutti...)
@@ -151,6 +176,25 @@ namespace MP.MONO.UI.Data
return await Task.FromResult(dbResult);
}
/// <summary>
/// Recupero elenco allarmi Rec con data <= alla data di riferimento (ultimi dato "skip")
/// </summary>
/// <param name="MachineId"></param>
/// <param name="dtRif"></param>
/// <param name="skipRec"></param>
/// <param name="numRec"></param>
/// <returns></returns>
public async Task<List<AlarmRecModel>> AlarmRecGetFiltByDate(int MachineId, DateTime dtRif, int skipRec, int numRec)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
var dbResult = dbController.AlarmRecGetFiltByDate(MachineId, dtRif, skipRec, numRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB AlarmRecGetFilt: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
/// <summary>
/// Recupero lista sommatoria durata eventi allarme per analisi, ordinati in logica di
/// pareto (Max-min)
@@ -191,11 +235,20 @@ namespace MP.MONO.UI.Data
return await Task.FromResult(dbResult);
}
public async Task<List<DataLogModel>> DataLogGetFilt(int machineId, string fluxType, DateTime inizio, DateTime fine)
/// <summary>
/// TimeSearie in formato DataLogModel
/// </summary>
/// <param name="machineId">ID macchina</param>
/// <param name="dataType">Tipologia di dato richiesto da enum</param>
/// <param name="fluxType">Tipo di Flusso</param>
/// <param name="inizio">DT Inizio estrazione</param>
/// <param name="fine">DT Fine estrazione</param>
/// <returns></returns>
public async Task<List<DataLogModel>> DataLogGetFilt(int machineId, DataLogType dataType, string fluxType, DateTime inizio, DateTime fine)
{
string source = "DB";
List<DataLogModel> dbResult = new List<DataLogModel>();
string currKey = $"{Constants.DATA_LOG_KEY}:{machineId}:{fluxType.Replace(" ", "_")}:{inizio:yyyyMMdd}:{fine:yyyyMMdd}";
string currKey = $"{Constants.DATA_LOG_KEY}:{machineId}:{dataType}:{fluxType.Replace(" ", "_")}:{inizio:yyyyMMdd}:{fine:yyyyMMdd}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string rawData = await redisDb.StringGetAsync(currKey);
@@ -214,21 +267,30 @@ namespace MP.MONO.UI.Data
}
else
{
dbResult = dbController.DataLogGetFilt(machineId, fluxType, inizio, fine);
dbResult = dbController.DataLogGetFilt(machineId, dataType, fluxType, inizio, fine);
// salvo per 2 min...
rawData = JsonConvert.SerializeObject(dbResult);
await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromSeconds(120));
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"DataLogGetFilt | {machineId} | {fluxType} | {inizio:yyyyMMdd}-{fine:yyyyMMdd} | {source} | {ts.TotalMilliseconds} ms | {rawData.Length / 1024} kb");
Log.Info($"DataLogGetFilt | {machineId} | {dataType} | {fluxType} | {inizio:yyyyMMdd}-{fine:yyyyMMdd} | {source} | {ts.TotalMilliseconds} ms | {rawData.Length / 1024} kb");
return dbResult;
}
public async Task<List<DataLogDTO>> DataLogDtoGetFilt(int machineId, string fluxType, DateTime inizio, DateTime fine)
/// <summary>
/// TimeSearie in formato DataLogDTO
/// </summary>
/// <param name="machineId">ID macchina</param>
/// <param name="dataType">Tipologia di dato richiesto da enum</param>
/// <param name="fluxType">Tipo di Flusso</param>
/// <param name="inizio">DT Inizio estrazione</param>
/// <param name="fine">DT Fine estrazione</param>
/// <returns></returns>
public async Task<List<DataLogDTO>> DataLogDtoGetFilt(int machineId, DataLogType dataType, string fluxType, DateTime inizio, DateTime fine)
{
string source = "DB";
List<DataLogDTO> dbResult = new List<DataLogDTO>();
string currKey = $"{Constants.DATA_LOG_DTO_KEY}:{machineId}:{fluxType.Replace(" ", "_")}:{inizio:yyyyMMdd}:{fine:yyyyMMdd}";
string currKey = $"{Constants.DATA_LOG_DTO_KEY}:{machineId}:{dataType}:{fluxType.Replace(" ", "_")}:{inizio:yyyyMMdd}:{fine:yyyyMMdd}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string rawData = await redisDb.StringGetAsync(currKey);
@@ -247,14 +309,14 @@ namespace MP.MONO.UI.Data
}
else
{
dbResult = dbController.DataLogDtoGetFilt(machineId, fluxType, inizio, fine);
dbResult = dbController.DataLogDtoGetFilt(machineId, dataType, fluxType, inizio, fine);
// salvo per 2 min...
rawData = JsonConvert.SerializeObject(dbResult);
await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromSeconds(120));
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"DataLogDtoGetFilt | {machineId} | {fluxType} | {inizio:yyyyMMdd}-{fine:yyyyMMdd} | {source} | {ts.TotalMilliseconds} ms | {rawData.Length / 1024} kb");
Log.Info($"DataLogDtoGetFilt | {machineId} | {dataType} | {fluxType} | {inizio:yyyyMMdd}-{fine:yyyyMMdd} | {source} | {ts.TotalMilliseconds} ms | {rawData.Length / 1024} kb");
return dbResult;
}
+2 -2
View File
@@ -3,8 +3,8 @@
public class DataLogFilter
{
public DateTime DtStart { get; set; } = DateTime.Today.AddDays(-1);
public DateTime DtEnd { get; set; } = DateTime.Today.AddDays(1);
public DateTime DtStart { get; set; } = DateTime.Today.AddDays(-3);
public DateTime DtEnd { get; set; } = DateTime.Today.AddDays(3);
public override bool Equals(object obj)
{
+73
View File
@@ -0,0 +1,73 @@
namespace MP.MONO.UI.Data
{
public class MessageService
{
#region Public Events
public event Action EA_PageUpdated;
#endregion Public Events
#region Public Properties
public int currPage
{
get => _currPage;
set
{
if (_currPage != value)
{
_currPage = value;
if (EA_PageUpdated != null)
{
EA_PageUpdated?.Invoke();
}
}
}
}
public int numRecord
{
get => _numRecord;
set
{
if (_numRecord != value)
{
_numRecord = value;
if (EA_PageUpdated != null)
{
EA_PageUpdated?.Invoke();
}
}
}
}
#endregion Public Properties
#region Protected Methods
protected void reportPaging()
{
if (EA_PageUpdated != null)
{
EA_PageUpdated?.Invoke();
}
}
#endregion Protected Methods
#region Private Fields
#endregion Private Fields
#region Private Properties
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
private int _totalVar { get; set; } = 0;
#endregion Private Properties
}
}
+29
View File
@@ -0,0 +1,29 @@
namespace MP.MONO.UI.Data
{
public class Utils
{
#region Public Methods
/// <summary> Inizializzazione con periodo e arrotondamento </summary> <param
/// name="dtRef">DataORa di riferimento</param> <param name="minRound">Arrotondamento
/// desiderato</param> <param name="roundMode">Parametro arrotondamento: se > 0 per eccesso,
/// se <= 0 per difetto</param> <returns></returns>
public static DateTime RoundDatetime(DateTime dtRef, int minRound, int roundMode)
{
TimeSpan DayElapsed = dtRef.Subtract(dtRef.Date);
int minDay = 0;
if (roundMode > 0)
{
minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
}
else
{
minDay = (int)Math.Floor((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
}
DateTime endRounded = dtRef.Date.AddMinutes(minDay);
return endRounded;
}
#endregion Public Methods
}
}
+73
View File
@@ -0,0 +1,73 @@
namespace MP.MONO.UI.Data
{
public class selectChartParams
{
#region Public Constructors
public selectChartParams()
{ }
#endregion Public Constructors
#region Public Properties
/// <summary>
/// Pagina corrente selezionata
/// </summary>
public int CurrPage { get; set; } = 1;
/// <summary>
/// Data fine periodo
/// </summary>
public DateTime dtMax { get; set; } = Utils.RoundDatetime(DateTime.Now, 5, 1);
/// <summary>
/// Data inizio periodo
/// </summary>
public DateTime dtMin { get; set; } = Utils.RoundDatetime(DateTime.Now.AddDays(-1), 5, 0);
/// <summary>
/// Numero di record per pagina
/// </summary>
public int NumRecord { get; set; } = 10;
/// <summary>
/// Bool: indica se sia richeista analisi per frequenza (vs durata)
/// </summary>
public bool setFreqDur { get; set; } = true;
#endregion Public Properties
#region Public Methods
public override bool Equals(object obj)
{
if (!(obj is selectChartParams item))
return false;
if (NumRecord != item.NumRecord)
return false;
if (CurrPage != item.CurrPage)
return false;
if (setFreqDur != item.setFreqDur)
return false;
if (dtMax != item.dtMax)
return false;
if (dtMin != item.dtMin)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2615</Version>
<Version>1.2.2210.419</Version>
</PropertyGroup>
<ItemGroup>
+58 -38
View File
@@ -7,7 +7,7 @@
@inject CurrentDataService MMDataService
<div class="card">
<div class="card mb-5">
<div class="card-header">
<div class="row">
<div class="col-12 col-md-6 col-lg-3">
@@ -15,18 +15,34 @@
</div>
<div class="col-12 col-md-6 col-lg-9 float-end">
<div class="d-flex flex-row-reverse">
<div class="p-2">
<div class="form-group mb-0">
<button id="btnReset" class="btn btn-primary btn-sm btn-block" @onclick="() => ReloadData(true)" title="Reset Filter"><span class="oi oi-loop-circular"></span></button>
</div>
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">Last Records:</span>
<div class="p-0">
@if (showParams)
{
<div class="input-group input-group-sm py-1 pt-0">
@if (!maxRecordStatus)
{
<span class="input-group-text ">Num Records:</span>
<input class="form-control form-control-sm" id="maxRecord" @bind-value="@MaxRecord" title="Max number of record to retrieve" disabled />
}
else
{
<span class="input-group-text">Num Records:</span>
<input class="form-control form-control-sm" id="maxRecord" @bind-value="@MaxRecord" title="Max number of record to retrieve" enabled />
}
@*<button id="btnReset" class="btn btn-primary btn-sm btn-block" @onclick="() => ReloadData(true)" title="Reset Filter"><span class="oi oi-loop-circular"></span></button>*@
<label class="input-group-text" title="Analisys: dataset end">Date From:</label>
<input @bind="@dtRif" id="DtRefEnd" class="form-control" type="datetime-local" title="Show alarms from selected date back">
<button class="btn btn-default btn-block " @onclick="toggleShowParams" title="Hide Parameters"><i class="fa-solid fa-ellipsis-vertical"></i></button>
</div>
<input class="form-control form-control-sm" @bind-value="@MaxRecord" title="Max number of record to show" />
</div>
}
else
{
<div class="input-group input-group-sm pt-1">
<button class="btn btn-default btn-block" @onclick="toggleShowParams" title="Show Parameters"><i class="fa-solid fa-ellipsis"></i></button>
</div>
}
</div>
</div>
</div>
@@ -46,6 +62,7 @@
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" value="@doSetup" unchecked @onclick="() => CheckAuth()">
<label class="form-check-label" for="mySwitch">Setup</label>
</div>
</div>
</div>
</div>
@@ -76,34 +93,37 @@
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="px-2 col-8 d-flex justify-content-between">
<div>
<h5>Alarm History</h5>
<div class="px-2 col-12 d-flex justify-content-between">
<div class="col-4">
<h5 class="py-1" cla>Alarm History</h5>
</div>
@*<div class="py-1" style="border-left: 3px solid black;
height: 30px;"></div>*@
<div ></div>
<h7 class="py-1">Choose modality:</h7>
<div class="form-switch mx-2 py-1 col-6 d-flex justify-content-between">
<input class="form-check-input col-2 py-1" type="checkbox" role="switch" id="toggleRec" title="Show Alarms log or Alarm rec" @onclick="() => toggleRec()">
<label class="col-12" for="toggleRec">@currMode</label>
<div class="col-8 d-flex justify-content-between">
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1 @SRCSSmode">SINGLE REC</span>
<div class="form-check form-check-sm form-switch py-1" title="Parameter View Mode (RealTime / LogData)">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" title="Show Alarms log or Alarm rec" checked @onclick="() => toggleRec()">
</div>
<span class="@SHCSSmode">STATUS HISTORY</span>
</div>
</div>
<div class="px-2 col-4 d-flex justify-content-end">
@if (!liveUpdate)
{
<button class="btn btn-secondary" type="button" @onclick="() => toggleUpdate()">
<small>@lastUpdate</small>
</button>
}
else
{
<button class="btn btn-primary" type="button" @onclick="() => toggleUpdate()">
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
Live update
</button>
}
</div>
</div>
</div>
<div class="px-2">
@if (!liveUpdate)
{
<button class="btn btn-secondary" type="button" @onclick="() => toggleUpdate()">
<small>@lastUpdate</small>
</button>
}
else
{
<button class="btn btn-primary" type="button" @onclick="() => toggleUpdate()">
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
Live update
</button>
}
</div>
</div>
</div>
@if (setLogRec)
@@ -212,7 +232,7 @@
<div class="text-success">@record.AlarmListNav.FullValue</div>
</td>
<td>
<div class="text-success">FINISHED</div>
<div class="text-success">CLOSED</div>
</td>
<td>
<div class="float-end">@TimeSpan.FromMinutes(@record.Duration).ToString(@"hh\:mm\:ss")</div>
+100 -4
View File
@@ -9,6 +9,8 @@ namespace MP.MONO.UI.Pages
protected bool doSetup = false;
protected bool reqPassw = false;
protected string SHCSSmode = "fw-bold";
protected string SRCSSmode = "text-secondary";
#endregion Protected Fields
@@ -16,10 +18,11 @@ namespace MP.MONO.UI.Pages
public bool liveUpdate { get; set; } = true;
public bool setLogRec { get; set; } = true;
public string lastUpdate { get; set; } = "-";
public string lastUpdate { get; set; } = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
private bool maxRecordStatus { get; set; } = false;
protected string currMode
{
get => setLogRec ? "Status history" : "Single Rec";
get => setLogRec ? "Status History mode" : "Single Rec mode";
}
public void Dispose()
@@ -76,6 +79,39 @@ namespace MP.MONO.UI.Pages
}
}
}
private DateTime _dtRif = DateTime.Now;
private DateTime dtRif
{
get
{
return _dtRif;
}
set
{
if (_dtRif != value)
{
_dtRif = value;
DateTime adesso = DateTime.Now.AddSeconds(1);
if (_dtRif.Date != adesso.Date)
{
liveUpdate = false;
if (!liveUpdate)
{
lastUpdate = $"{adesso:yyyy/MM/dd HH:mm:ss}";
maxRecordStatus = true;
}
else
{
maxRecordStatus = false;
MaxRecord = 200;
}
}
var pUpd = Task.Run(async () => await ReloadData(true));
pUpd.Wait();
}
}
}
protected int RefreshPeriod { get; set; } = 2000;
private int totalCount
{
@@ -99,9 +135,27 @@ namespace MP.MONO.UI.Pages
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
liveUpdate = !liveUpdate;
DateTime adesso = DateTime.Now.AddSeconds(1);
liveUpdate = (currPage == 1);
//lastUpdate = liveUpdate ? "-" : $"{adesso:yyyy/MM/dd HH:mm:ss}";
if (!liveUpdate)
{
lastUpdate = $"{adesso:yyyy/MM/dd HH:mm:ss}";
maxRecordStatus = true;
}
else
{
maxRecordStatus = false;
MaxRecord = 200;
}
StateHasChanged();
}
protected override async Task OnInitializedAsync()
@@ -118,7 +172,7 @@ namespace MP.MONO.UI.Pages
SearchRecordsREC = await MMDataService.AlarmRecGetFilt(MachineId, 0, MaxRecord);
ListRecordsREC = SearchRecordsREC.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
await ReloadData(true);
await ReloadData(true);
}
protected async Task ReloadData(bool setChanged)
@@ -131,9 +185,11 @@ namespace MP.MONO.UI.Pages
//ListRecordsREC = null;
if (setLogRec)
{
SearchRecords = await MMDataService.AlarmLogGetFilt(MachineId, 0, MaxRecord);
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
}
else
{
@@ -143,6 +199,21 @@ namespace MP.MONO.UI.Pages
}
}
else
{
if (setLogRec)
{
SearchRecords = await MMDataService.AlarmLogGetFiltByDate(MachineId, dtRif, 0, MaxRecord);
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
}
else
{
SearchRecordsREC = await MMDataService.AlarmRecGetFiltByDate(MachineId, dtRif, 0, MaxRecord);
ListRecordsREC = SearchRecordsREC.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
}
}
await Task.Delay(1);
isLoading = false;
}
@@ -187,16 +258,34 @@ namespace MP.MONO.UI.Pages
protected async Task toggleUpdate()
{
liveUpdate = !liveUpdate;
currPage = 1;
await Task.Delay(1);
if (!liveUpdate)
{
lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
maxRecordStatus = true;
}
else
{
MaxRecord = 200;
maxRecordStatus = false;
dtRif = DateTime.Now;
}
await ReloadData(true);
}
protected async Task toggleRec()
{
setLogRec = !setLogRec;
if (setLogRec)
{
SHCSSmode = "fw-bold";
SRCSSmode = "text-secondary";
}
else
{
SRCSSmode = "fw-bold";
SHCSSmode = "text-secondary";
}
await Task.Delay(1);
await ReloadData(true);
}
@@ -255,5 +344,12 @@ namespace MP.MONO.UI.Pages
}
#endregion Private Properties
private bool showParams = false;
private void toggleShowParams()
{
showParams = !showParams;
}
}
}
+9 -122
View File
@@ -3,136 +3,23 @@
@using MP.MONO.UI.Components
<div class="card">
<div class="card-header table-primary p-1 d-flex justify-content-between">
<div>
<h5>Alarm analysis</h5>
<div class="card mb-5">
<div class=" col-12 card-header table-primary d-flex justify-content-between ">
<div class="col-2 pt-1">
<h3>Alarm analysis</h3>
</div>
<div class="px-2 col-4 d-flex justify-content-between">
<h7 class="py-1">Choose modality:</h7>
<div class="form-switch mx-3 py-1 col-7 d-flex justify-content-between">
<input class="form-check-input col-2 py-1" type="checkbox" role="switch" id="toggleRec" title="Show Alarms log or Alarm rec" @onclick="() => toggleRec()">
<label class="col-12" for="toggleRec">@currMode</label>
</div>
</div>
<div class="col-6 d-flex justify-content-between">
<div class="input-group mb-3">
<label class="input-group-text" title="Choose Date/Time where to start analizing">Start</label>
<input @bind=dtStart id ="DtRef" class="form-control" type="datetime-local" title="Choose Date/Time where to start analizing">
<label class="input-group-text" title="Choose Date/Time where to finish analizing">End</label>
<input @bind=dtEnd id="DtRef" class="form-control" type="datetime-local" title="Choose Date/Time where to finish analizing">
</div>
<div class="col-10">
<AlAnFilter FilterChanged="updateFilter"></AlAnFilter>
</div>
</div>
<div class="card-body py-0 px-1">
@if (ShowCharts == true)
@if (setFreqDur)
{
@*<ChartAlarms RawData="SearchRecords"></ChartAlarms>*@
}@*
@if (currRecord != null)
{
<DetailOee currRecord="@currRecord"></DetailOee>
}*@
@if ((ListRecordsFreq == null && setFreqDur) || (ListRecordsDur == null && !setFreqDur))
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
<ListFreqAlarms selFilter="@currFilter" TotRecordChanged="@updateTotal"></ListFreqAlarms>
}
else
{
@if (setFreqDur)
{
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Alarm Description</th>
<th>Alarm Event Count</th>
<th>Event Frequence</th>
<th>Event Frequence Chart</th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecordsFreq)
{
<tr>
<td>
<div>@record.AlarmDescription</div>
</td>
<td>
<div>@record.EventCount</div>
</td>
<td>
<div>
@if (totalVar != 0)
{
<span class="text-success">@calcPerc((double)record.EventCount)</span>
}
</div>
</td>
<td>
<div class="progress">
<div class="progress-bar @styleColourPBar((double)record.EventCount/totalVar)" role="progressbar" style="@val((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
else
{
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Alarm Description</th>
<th>Alarm Duration</th>
@*<th>Event Frequence</th>
<th>Event Frequence Chart</th>*@
</tr>
</thead>
<tbody>
@foreach (var item in ListRecordsDur)
{
<tr>
<td>
<div>@item.AlarmDescription</div>
</td>
<td>
<div>@item.Duration</div>
</td>
@*<td>
<div>
@if (totalEvents != 0)
{
<span class="text-success">@calcPerc((double)record.EventCount)</span>
}
</div>
</td>
<td>
<div class="progress">
<div class="progress-bar @styleColourPBar((double)record.EventCount/totalEvents)" role="progressbar" style="@val((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
</div>
</td>*@
</tr>
}
</tbody>
</table>
</div>
</div>
}
<ListDurAlarms selFilter="@currFilter" TotRecordChanged="@updateTotal"></ListDurAlarms>
}
</div>
<div class="card-footer py-1">
+99 -253
View File
@@ -1,190 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP.MONO.UI;
using MP.MONO.UI.Shared;
using MP.MONO.UI.Components;
using MP.MONO.Data.DbModels;
using MP.MONO.UI.Data;
using MP.MONO.Data.DTO;
using System.Diagnostics.Tracing;
using System.Security.Cryptography.X509Certificates;
using System.DirectoryServices.Protocols;
using System.Security;
using MP.MONO.UI.Data;
namespace MP.MONO.UI.Pages
{
public partial class AlarmsAnalysis
{
#region Private Fields
#region Public Properties
private AlarmFreqDTO? currRecord = null;
private List<AlarmFreqDTO>? ListRecordsFreq = null;
private List<AlarmDurationDTO>? ListRecordsDur = null;
private List<AlarmFreqDTO>? SearchRecordsFreq = null;
private List<AlarmDurationDTO>? SearchRecordsDur = null;
#endregion Private Fields
#region Private Properties
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
protected double totalVar = 0;
protected string percEvents = "";
private int currPage
public bool setFreqDur
{
get => _currPage;
get => currFilter.setFreqDur;
set
{
if (_currPage != value)
if (currFilter.setFreqDur != value)
{
_currPage = value;
currFilter.setFreqDur = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
//protected int _numHourPrev = 24;
//protected int numHourPrev
//{
// get => _numHourPrev;
// set
// {
// _numHourPrev = value;
// var pUpd = Task.Run(async () =>
// {
// await ReloadData();
// });
// pUpd.Wait();
// }
//}
#endregion Public Properties
#region Protected Fields
protected string percEvents = "";
protected double totalVar = 0;
#endregion Protected Fields
#region Protected Properties
#if false
protected string currMode
{
get => setFreqDur ? "Alarm frequency" : "Alarm duration";
}
public bool setFreqDur { get; set; } = true;
protected async Task toggleRec()
{
setFreqDur = !setFreqDur;
await Task.Delay(1);
await ReloadData();
}
protected DateTime _dtStart = DateTime.Now.AddHours(-24);
protected DateTime dtStart
{
get => _dtStart;
set
{
_dtStart = value;
var pUpd = Task.Run(async () =>
{
await ReloadData();
});
pUpd.Wait();
}
}
protected DateTime _dtEnd = DateTime.Now;
#endif
protected DateTime dtEnd
{
get => _dtEnd;
set
{
_dtEnd = value;
var pUpd = Task.Run(async () =>
{
await ReloadData();
});
pUpd.Wait();
}
get => currFilter.dtMax;
}
private bool isLoading { get; set; } = false;
private int numRecord
protected DateTime dtStart
{
get => _numRecord;
set
{
if (_numRecord != value)
{
_numRecord = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
get => currFilter.dtMin;
}
private bool ShowCharts { get; set; } = true;
#endregion Private Properties
#region Protected Properties
protected int totalCount { get; set; } = 0;
//{
// get
// {
// int answ = 0;
// if (SearchRecordsFreq != null && setFreqDur)
// {
// answ = SearchRecordsFreq.Count;
// }
// else
// {
// //answ = SearchRecordsDur.Count;
// }
// return answ;
// }
//}
#endregion Protected Properties
#region Private Methods isLoading = false;
//}
private async Task ReloadData()
{
isLoading = true;
DateTime adesso = DateTime.Now;
//SearchRecords = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, adesso.AddHours(-numHourPrev), adesso);
if (setFreqDur)
{
SearchRecordsFreq = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, dtStart, dtEnd);
ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsFreq.Count;
totalVar = SearchRecordsFreq.Sum(x => x.EventCount);
calcolaSoglie();
await Task.Delay(1);
}
else
{
SearchRecordsDur = CurrentDataService.dbController.AlarmRecGetParetoDur(1, dtStart, dtEnd);
ListRecordsDur = SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsDur.Count;
totalVar = SearchRecordsDur.Sum(x => x.Duration);
await Task.Delay(1);
}
await Task.Delay(1);
isLoading = false;
}
#endregion Private Methods
#region Protected Methods
protected void ForceReload(int newNum)
@@ -200,83 +67,20 @@ namespace MP.MONO.UI.Pages
protected override async Task OnInitializedAsync()
{
numRecord = 10;
if (setFreqDur)
{
SearchRecordsFreq = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, dtStart, dtEnd);
ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
else
{
SearchRecordsDur = CurrentDataService.dbController.AlarmRecGetParetoDur(1, dtStart, dtEnd);
ListRecordsDur= SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
await ReloadData();
await Task.Delay(1);
}
private double sogliaGreen = 0;
private double sogliaRed = 1;
private void calcolaSoglie()
protected override async Task OnParametersSetAsync()
{
int numRecord = SearchRecordsFreq.Count;
var firstRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.2)).FirstOrDefault();
var lastRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
{
sogliaGreen = (double)firstRecord.EventCount / totalVar;
}
if (lastRecord != null)
{
sogliaRed = (double)lastRecord.EventCount / totalVar;
}
isLoading = true;
await ReloadData();
await Task.Delay(1);
}
protected void ResetData()
{
currRecord = null;
}
protected string calcPerc(double numEvent)
{
string ans = $"{numEvent / totalVar:P2}";
return ans;
}
protected string val(double eventCount)
{
int max = SearchRecordsFreq.Max(a => a.EventCount);
double divisione = eventCount / max;
int percentage = (int)(divisione * 100);
string ans = $"width: {percentage}%";
return ans;
}
protected string styleColourPBar(double eventFreq)
{
string ans = "";
var source = ListRecordsFreq;
calcolaSoglie();
if (eventFreq >= sogliaGreen)
{
ans = "bg-danger";
}
else if (eventFreq <= sogliaRed)
{
ans = "bg-success";
}
else
{
ans = "bg-warning";
}
return ans;
}
protected void Select(AlarmFreqDTO selRecord)
{
@@ -284,13 +88,11 @@ namespace MP.MONO.UI.Pages
currRecord = selRecord;
}
protected async Task ToggleChart(bool doShow)
protected async Task toggleRec()
{
ShowCharts = !ShowCharts;
if (ShowCharts)
{
await ReloadData();
}
setFreqDur = !setFreqDur;
await Task.Delay(1);
await ReloadData();
}
protected async Task UpdateData()
@@ -298,40 +100,84 @@ namespace MP.MONO.UI.Pages
currRecord = null;
await ReloadData();
}
protected override async Task OnParametersSetAsync()
protected void updateTotal(int newTotCount)
{
isLoading = true;
await ReloadData();
await Task.Delay(1);
totalCount = newTotCount;
}
#endregion Protected Methods
#region Public Methods
#region Private Fields
public string checkSelect(DateTime DtStart, double EventCount, int IdxMacchina)
private AlarmFreqDTO? currRecord = null;
#endregion Private Fields
#region Private Properties
private int _numRecord { get; set; } = 10;
private selectChartParams currFilter { get; set; } = new selectChartParams();
private int currPage
{
string answ = "";
if (currRecord != null)
get => currFilter.CurrPage;
set
{
try
if (currFilter.CurrPage != value)
{
answ = (currRecord.MachineId == IdxMacchina && currRecord.EventCount == EventCount) ? "table-info" : "";
currFilter.CurrPage = value;
}
catch
{ }
}
return answ;
}
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
{
Task task = UpdateData();
StateHasChanged();
});
}
#endregion Public Methods
private bool isLoading { get; set; } = false;
private int numRecord
{
get => currFilter.NumRecord;
set
{
if (currFilter.NumRecord != value)
{
currFilter.NumRecord = value;
}
}
}
#endregion Private Properties
#region Private Methods
private async Task ReloadData()
{
isLoading = true;
await Task.Delay(1);
isLoading = false;
}
private async Task updateFilter(selectChartParams newParams)
{
isLoading = true;
await Task.Delay(1);
currPage = 1;
if (newParams.CurrPage == 0)
{
newParams.CurrPage = 1;
}
await Task.Delay(1);
newParams.dtMax = dtEnd;
newParams.dtMin = dtStart;
await InvokeAsync(() => StateHasChanged());
currFilter = newParams;
isLoading = false;
}
#endregion Private Methods
}
}
+32 -36
View File
@@ -5,84 +5,80 @@
<div class="card">
<div class="card-header"><h1>MAPO-MONO</h1></div>
<div class="card-body">
<div class="row row-cols-2 row-cols-md-4 g-2">
<div class="row">
@*<div class="col">
<NavLink href="Stats" class="text-decoration-none">
<div class="card text-white mb-3">
<h5 class="card-header text-center bg-primary"><i class="bi bi-graph-up-arrow pe-2"></i> MACHINE STATS</h5>
<div class="card-body bg-light text-dark">
<div class="card-body bg-light text-dark p-1">
</div>
</div>
</NavLink>
</div>*@
<div class="col">
<div class="col-3">
<NavLink href="Production" class="text-decoration-none">
<div class="card text-white mb-3">
<h5 class="card-header text-center bg-primary"><i class="fa-solid fa-gears"></i> PRODUCTION</h5>
<div class="card-body bg-light text-dark">
<div class="card-body bg-light text-dark p-1">
<MachStatsOverview></MachStatsOverview>
<ProdOverview></ProdOverview>
</div>
</div>
</NavLink>
</div>
<div class="col">
<NavLink href="Parameters" class="text-decoration-none">
<div class="card text-white mb-3">
<h5 class="card-header text-center bg-primary"><i class="fa-solid fa-list-ul"></i> PARAMETERS</h5>
<div class="card-body bg-light text-dark">
<ParamOverview ShowReduced="true"></ParamOverview>
</div>
</div>
</NavLink>
</div>
<div class="col">
<NavLink href="Tools" class="text-decoration-none">
<div class="card text-white mb-3">
<h5 class="card-header text-center bg-primary"><i class="fa-solid fa-toolbox"></i> TOOLS</h5>
<div class="card-body bg-light text-dark">
<ToolsOverview></ToolsOverview>
</div>
</div>
</NavLink>
</div>
<div class="col">
<NavLink href="Alarms" class="text-decoration-none">
<div class="card text-white mb-3">
<h5 class="card-header text-center bg-primary"><i class="fa-solid fa-triangle-exclamation"></i> ALARMS</h5>
<div class="card-body bg-light text-dark">
<div class="card-body bg-light text-dark p-1">
<AlarmsOverview></AlarmsOverview>
</div>
</div>
</NavLink>
</div>
<div class="col-3">
<NavLink href="Parameters" class="text-decoration-none">
<div class="card text-white mb-3">
<h5 class="card-header text-center bg-primary"><i class="fa-solid fa-list-ul"></i> PARAMETERS</h5>
<div class="card-body bg-light text-dark p-1">
<ParamOverview ShowReduced="true"></ParamOverview>
</div>
</div>
</NavLink>
</div>
<div class="row row-cols-1 row-cols-md-2 g-2">
<div class="col">
<div class="col-3">
<NavLink href="Maintenance" class="text-decoration-none">
<div class="card text-white mb-3">
<h5 class="card-header text-center bg-primary"><i class="fa-solid fa-screwdriver-wrench"></i> MAINTENANCE</h5>
<div class="card-body bg-light text-dark">
<div class="card-body bg-light text-dark p-1">
<MaintTaskPending compMode="true"></MaintTaskPending>
</div>
</div>
</NavLink>
</div>
<div class="col">
<NavLink href="Events" class="text-decoration-none">
<div class="col-3">
<NavLink href="Tools" class="text-decoration-none">
<div class="card text-white mb-3">
<h5 class="card-header text-center bg-primary"><i class="fa-solid fa-clock-rotate-left"></i> EVENT HISTORY</h5>
<div class="card-body bg-light text-dark">
<EventsOverview></EventsOverview>
<h5 class="card-header text-center bg-primary"><i class="fa-solid fa-toolbox"></i> TOOLS</h5>
<div class="card-body bg-light text-dark p-1">
<ToolsOverview ShowReduced="true"></ToolsOverview>
</div>
</div>
</NavLink>
</div>
@*<div class="col">
<NavLink href="Events" class="text-decoration-none">
<div class="card text-white mb-3">
<h5 class="card-header text-center bg-primary"><i class="fa-solid fa-clock-rotate-left"></i> EVENT HISTORY</h5>
<div class="card-body bg-light text-dark p-1">
<EventsOverview></EventsOverview>
</div>
</div>
</NavLink>
</div>*@
@*<div class="col">
<NavLink href="Activity" class="text-decoration-none">
<div class="card text-white mb-3">
<h5 class="card-header text-center bg-primary"><i class="fa-solid fa-wave-square"></i> ACTIVITY LOG</h5>
<div class="card-body bg-light text-dark">
<div class="card-body bg-light text-dark p-1">
<ActivityOverview></ActivityOverview>
</div>
</div>
+1
View File
@@ -11,6 +11,7 @@
<MaintTaskPending reqChangeMode="() => ToggleMode()"></MaintTaskPending>
}
</div>
</div>
@code {
+53 -51
View File
@@ -2,58 +2,60 @@
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="px-2">
<div class="input-group input-group-lg">
<span class="input-group-text" id="inputGroup-sizing-lg"><b>Parameters</b></span>
<button @onclick="() => resetSel()" class="btn btn-dark @btnResetCss" title="Reset Selection"><i class="fa-solid fa-repeat" title="reset selection"></i></button>
<div class="input-group-text">
<div class="form-check form-check-sm form-switch" title="Parameter View Mode (RealTime / LogData)">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" value="@isRT" checked @onclick="() => toggleRT()">
<label class="form-check-label" for="mySwitch">@currMode</label>
</div>
<div class="row">
<div class="d-flex justify-content-between">
<div class="col-3 d-flex justify-content-between">
<div class="mx-0">
<h3>Parameters</h3>
</div>
<div class="input-group-text">
<div class=" input-group">
<button class="btn btn-primary" @onclick="() => toggleParam()">
@if (showParam)
{
<i class="fa-solid fa-chevron-left"></i>
}
else
{
<i class="fa-solid fa-chevron-right"></i>
}
</button>
@if (showParam)
{
@if (isRT)
{
<span class="input-group-text">Num Rec</span>
<input class="form-control" @bind="@maxRecord" />
<span class="input-group-text small">Sample Sec Time</span>
<input class="form-control" @bind="@sampleSecMin" />
}
else
{
<div class="input-group-prepend">
<span class="input-group-text">Date From</span>
</div>
<input type="date" class="form-control" placeholder="Data ultima" @bind-value="@DateFrom">
<div class="input-group-prepend">
<span class="input-group-text">Date To</span>
</div>
<input type="date" class="form-control" placeholder="Data ultima" @bind-value="@DateTo">
}
}
</div>
<div class="me-3">
<button @onclick="() => resetSel()" class="btn btn-dark @btnResetCss" title="Reset Selection"><i class="fa-solid fa-repeat" title="reset selection"></i></button>
</div>
</div>
</div>
<div class="px-2">
<div class="d-flex justify-content-between">
<div class="px-2">
<div class="col-9 d-flex justify-content-between">
<div class="px-0">
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1 @LVCSSmode">LOG VIEW</span>
<div class="form-check form-check-sm form-switch py-1" title="Parameter View Mode (RealTime / LogData)">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" value="@isRT" checked @onclick="() => toggleRT()">
</div>
<span class="@RTCSSmode">REAL TIME</span>
</div>
</div>
</div>
<div class="px-0">
<div class="d-flex flex-row-reverse">
<div class="p-0">
@if (showParam)
{
<div class="input-group input-group-sm d-flex justify-content-between pt-0">
@if (isRT)
{
<span class="input-group-text">Num Rec</span>
<input class="form-control" @bind="@maxRecord" />
<span class="input-group-text small">Sample Sec Time</span>
<input class="form-control" @bind="@sampleSecMin" />
}
else
{
<span class="input-group-text">Date From</span>
<input type="date" class="form-control" placeholder="Data ultima" @bind-value="@DateFrom">
<span class="input-group-text">Date To</span>
<input type="date" class="form-control" placeholder="Data ultima" @bind-value="@DateTo">
}
<button class="btn btn-default btn-block " @onclick="toggleShowParams" title="Hide Parameters"><i class="fa-solid fa-ellipsis-vertical"></i></button>
</div>
}
else
{
<div class="input-group input-group-sm pt-1">
<button class="btn btn-default btn-block" @onclick="toggleShowParams" title="Show Parameters"><i class="fa-solid fa-ellipsis"></i></button>
</div>
}
</div>
</div>
</div>
</div>
</div>
@@ -61,10 +63,10 @@
</div>
<div class="card-body">
<div class="row">
<div class="col-4">
<div class="col-3">
<ParamOverview SelVal="@selParams" EC_AddValue="paramAdded" EC_RemValue="paramRemoved"></ParamOverview>
</div>
<div class="col-8">
<div class="col-9">
@if (selParams == null || selParams.Count == 0)
{
<p>&larr; please select an item to plot graph</p>
+16
View File
@@ -29,6 +29,8 @@ namespace MP.MONO.UI.Pages
protected bool isRT = true;
protected double sampleSecMin = 1;
protected string RTCSSmode = "fw-bold";
protected string LVCSSmode = "text-secondary";
#endregion Protected Fields
@@ -122,8 +124,22 @@ namespace MP.MONO.UI.Pages
protected void toggleRT()
{
isRT = !isRT;
if (isRT)
{
RTCSSmode = "fw-bold";
LVCSSmode = "text-secondary";
}
else
{
LVCSSmode = "fw-bold";
RTCSSmode = "text-secondary";
}
}
#endregion Protected Methods
private void toggleShowParams()
{
showParam = !showParam;
}
}
}
+94 -15
View File
@@ -1,22 +1,101 @@
@page "/Tools"
<div class="row">
<div class="col-4">
<div class="card">
<div class="card-header">
<h3>Tools</h3>
</div>
<div class="card-body">
<ToolsOverview></ToolsOverview>
@inject MP.MONO.UI.Data.CurrentDataService MMDataService
<div class="card mb-5">
<div class="card-header">
<div class="row">
<div class="d-flex justify-content-between">
<div class="col-3 d-flex justify-content-between">
<div class="mx-0">
<h3>Tools</h3>
</div>
<div class="d-flex justify-content-between">
<div class="me-3">
<button @onclick="() => resetSel()" class="btn btn-dark @btnResetCss" title="Reset Selection"><i class="fa-solid fa-repeat" title="Reset selection"></i></button>
</div>
<div class="me-3">
<button @onclick="() => selAll()" class="btn btn-dark" title="Reset Selection"><i class="fa-regular fa-square-check" title="Select all"></i></button>
</div>
</div>
</div>
<div class="col-9 d-flex justify-content-between">
<div class="px-0">
<div class="input-group input-group-sm">
<div class="input-group-text">
<span class="me-1 @LVCSSmode">LOG VIEW</span>
<div class="form-check form-check-sm form-switch py-1" title="Parameter View Mode (RealTime / LogData)">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" value="@isRT" checked @onclick="() => toggleRT()">
</div>
<span class="@RTCSSmode">REAL TIME</span>
</div>
</div>
</div>
<div class="px-0">
<div class="d-flex flex-row-reverse">
<div class="p-0">
@if (showParam)
{
<div class="input-group input-group-sm d-flex justify-content-between pt-0">
@if (isRT)
{
<span class="input-group-text">Num Rec</span>
<input class="form-control" @bind="@maxRecord" />
<span class="input-group-text small">Sample Sec Time</span>
<input class="form-control" @bind="@sampleSecMin" />
}
else
{
<span class="input-group-text">Date From</span>
<input type="date" class="form-control" placeholder="Data ultima" @bind-value="@DateFrom">
<span class="input-group-text">Date To</span>
<input type="date" class="form-control" placeholder="Data ultima" @bind-value="@DateTo">
}
<button class="btn btn-default btn-block " @onclick="toggleShowParams" title="Hide Parameters"><i class="fa-solid fa-ellipsis-vertical"></i></button>
</div>
}
else
{
<div class="input-group input-group-sm pt-1">
<button class="btn btn-default btn-block" @onclick="toggleShowParams" title="Show Parameters"><i class="fa-solid fa-ellipsis"></i></button>
</div>
}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-8">
<div class="card-body">
<div class="row">
<div class="col-3">
<ToolsOverview SelVal="@selTools" EC_AddValue="toolAdded" EC_RemValue="toolRemoved" selectAll="@selectAll"></ToolsOverview>
</div>
<div class="row col-9">
@if (isRT)
{
@foreach (var item in selTools)
{
<div class="@pcss">
<ToolsPlotRT SelectedTool="@item" maxRecord="@maxRecord" sampleSecMin="@sampleSecMin"></ToolsPlotRT>
</div>
}
}
else
{
@foreach (var item in selTools)
{
<div class="@pcss">
<ToolsPlot SelectedTool="@item" SelFilter="@SelFilter"></ToolsPlot>
</div>
}
}
</div>
</div>
</div>
</div>
@code {
}
+163
View File
@@ -0,0 +1,163 @@
using MP.MONO.Core.DTO;
using MP.MONO.Data;
using MP.MONO.UI.Data;
using Newtonsoft.Json;
namespace MP.MONO.UI.Pages
{
public partial class Tools
{
private List<DisplayDataDTO>? ListRecords { get; set; } = null;
//protected List<string> selParams { get; set; } = new List<string>();
#region Private Fields
private int maxRecord = 120;
private bool showParam = false;
private DateTime DateFrom
{
get => SelFilter.DtStart;
set => SelFilter.DtStart = value;
}
private DateTime DateTo
{
get => SelFilter.DtEnd;
set => SelFilter.DtEnd = value;
}
protected DataLogFilter SelFilter { get; set; } = new DataLogFilter();
#endregion Private Fields
#region Protected Fields
protected bool isRT = true;
protected double sampleSecMin = 1;
protected string RTCSSmode= "fw-bold";
protected string LVCSSmode= "text-secondary";
#endregion Protected Fields
#region Protected Properties
protected int currMode
{
get => isRT ? 0 : 1;
}
protected string btnResetCss
{
get => selTools != null && selTools.Count > 0 ? "" : "disabled";
}
protected bool selectAll { get; set; }
protected List<string> selTools { get; set; } = new List<string>();
#endregion Protected Properties
#region Public Properties
public string pcss
{
get
{
string answ = "col-12";
int numPar = selTools.Count;
if (numPar > 6)
{
answ = "col-4";
}
else if (numPar > 3)
{
answ = "col-6";
}
return answ;
}
}
#endregion Public Properties
#region Private Methods
#endregion Private Methods
#region Protected Methods
protected void toolAdded(string toolName)
{
if (!selTools.Contains(toolName))
{
selTools.Add(toolName);
}
}
protected override async Task OnInitializedAsync()
{
ListRecords = await MMDataService.getTools();
}
protected string lastTool
{
get
{
string answ = "";
if (selTools.Count > 0)
{
answ = $"{selTools.LastOrDefault()}";
}
return answ;
}
}
protected void toolRemoved(string toolName)
{
if (selTools.Contains(toolName))
{
// controllo se è ultimo rimuovo direttamente
if (toolName == lastTool)
{
selTools.Remove(toolName);
}
}
}
protected void resetSel()
{
selTools = new List<string>();
}
protected void selAll()
{
selTools = new List<string>();
selectAll = true;
if (ListRecords != null)
{
foreach (var item in ListRecords)
{
selTools.Add(item.Title);
}
}
}
protected void toggleRT()
{
isRT = !isRT;
if (isRT)
{
RTCSSmode = "fw-bold";
LVCSSmode = "text-secondary";
}
else
{
LVCSSmode = "fw-bold";
RTCSSmode = "text-secondary";
}
}
#endregion Protected Methods
private void toggleShowParams()
{
showParam = !showParam;
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2615</h4>
<h4>Version: 1.2.2210.419</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2615
1.2.2210.419
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2615</version>
<version>1.2.2210.419</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+14 -2
View File
@@ -3,8 +3,8 @@
<PageTitle>MP.MONO.UI</PageTitle>
<div class="page">
<div class="sidebar">
<NavMenu />
<div class="@sideClass">
<NavMenu EC_compressUpdated="@UpdateNavDisplay" />
</div>
<main>
@@ -19,3 +19,15 @@
</div>
</main>
</div>
@code {
protected bool navLarge { get; set; } = true;
protected string sideClass { get; set; } = "sidebar";
protected void UpdateNavDisplay()
{
navLarge = !navLarge;
sideClass = navLarge ? "sidebar" : "sidebarSmall";
}
}
+38 -22
View File
@@ -1,9 +1,13 @@
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">MP.MONO.UI</a>
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
@if (!showText)
{
<a class="navbar-brand p-0" @onclick="() => ToggleCompress()">M <i class="fas fa-caret-square-right"></i></a>
}
else
{
<a class="navbar-brand" @onclick="() => ToggleCompress()">MP.MONO.UI <i class="fas fa-caret-square-left"></i></a>
}
</div>
</div>
@@ -11,52 +15,52 @@
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<i class="bi bi-house-fill pe-2"></i> Index
<i class="bi bi-house-fill pe-2"></i> <span class="@hideText"> Index </span>
</NavLink>
</div>
@*<div class="nav-item px-3">
<NavLink class="nav-link" href="MachStats">
<i class="bi bi-graph-up-arrow pe-2"></i> STATS
</NavLink>
<NavLink class="nav-link" href="MachStats">
<i class="bi bi-graph-up-arrow pe-2"></i> STATS
</NavLink>
</div>*@
<div class="nav-item px-3">
<NavLink class="nav-link" href="Production">
<i class="bi bi-gear pe-2" aria-hidden="true"></i> PRODUCTION
<i class="bi bi-gear pe-2" aria-hidden="true"></i> <span class="@hideText"> PRODUCTION </span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Parameters">
<i class="bi bi-list-check pe-2" aria-hidden="true"></i> PARAMETERS
<i class="bi bi-list-check pe-2" aria-hidden="true"></i><span class="@hideText"> PARAMETERS </span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Alarms">
<i class="bi bi-exclamation-triangle pe-2" aria-hidden="true"></i> ALARMS
<i class="bi bi-exclamation-triangle pe-2" aria-hidden="true"></i> <span class="@hideText"> ALARMS </span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Maintenance">
<i class="fa-solid fa-screwdriver-wrench pe-2" aria-hidden="true"></i> MAINTENANCE
<i class="fa-solid fa-screwdriver-wrench pe-2" aria-hidden="true"></i> <span class="@hideText"> MAINTENANCE </span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Tools">
<i class="fa-solid fa-battery-half pe-2" aria-hidden="true"></i> TOOLS
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Events">
<i class="fa-solid fa-book pe-2" aria-hidden="true"></i> EVENTS LIST
<i class="fa-solid fa-battery-half pe-2" aria-hidden="true"></i> <span class="@hideText"> TOOLS </span>
</NavLink>
</div>
@*<div class="nav-item px-3">
<NavLink class="nav-link" href="ActLog">
<i class="bi bi-activity pe-2" aria-hidden="true"></i> ACTIVITY LOG
</NavLink>
<NavLink class="nav-link" href="Events">
<i class="fa-solid fa-book pe-2" aria-hidden="true"></i> EVENTS LIST
</NavLink>
</div>*@
@*<div class="nav-item px-3">
<NavLink class="nav-link" href="ActLog">
<i class="bi bi-activity pe-2" aria-hidden="true"></i> ACTIVITY LOG
</NavLink>
</div>*@
<div class="nav-item px-3">
<NavLink class="nav-link" href="Info">
<i class="bi bi-pc-display pe-2" aria-hidden="true"></i> HW Info
<i class="bi bi-pc-display pe-2" aria-hidden="true"></i> <span class="@hideText"> Hw Info </span>
</NavLink>
</div>
</nav>
@@ -71,4 +75,16 @@
{
collapseNavMenu = !collapseNavMenu;
}
protected bool showText { get; set; } = true;
protected string hideText
{
get => showText ? "" : "invisible";
}
protected void ToggleCompress()
{
showText = !showText;
EC_compressUpdated.InvokeAsync(showText);
}
[Parameter]
public EventCallback<bool> EC_compressUpdated { get; set; }
}
+1 -1
View File
@@ -20,7 +20,7 @@
"L2CacheSize": "2048",
"L3CacheSize": "4096",
"Level": "23",
"LoadPercentage": "32",
"LoadPercentage": "0",
"MACAddress": "4C:ED:FB:D9:78:83",
"Manufacturer": "American Megatrends Inc.",
"MaxNumberOfProcesses": "4294967295",
+3
View File
@@ -52,6 +52,9 @@ a,
left: 500px;
opacity: 0.2;
}
.selBlock {
background-color: #CFE2FF;
}
.textTrim {
white-space: nowrap;
overflow: hidden;
+4
View File
@@ -52,6 +52,10 @@ a, .btn-link {
opacity: 0.2;
}
.selBlock {
background-color: #CFE2FF;
}
.textTrim {
white-space: nowrap;
overflow: hidden;
File diff suppressed because one or more lines are too long