Merge branch 'develop' of https://bitbucket.org/ncarminati/cms_step into develop
This commit is contained in:
@@ -720,21 +720,21 @@ public static class ThreadsFunctions
|
||||
|
||||
public static void MonitorPanelPCResources()
|
||||
{
|
||||
float SumRec, SumSen;
|
||||
float sumRec, sumSen;
|
||||
Stopwatch sw = new Stopwatch();
|
||||
DTONetworkMonitor Monitor = new DTONetworkMonitor();
|
||||
int CardId = ServerConfig.ServerStartupConfig.NetworkCardId - 1;
|
||||
DTONetworkMonitorModel Monitor = new DTONetworkMonitorModel();
|
||||
int cardId = ServerConfig.ServerStartupConfig.NetworkCardId - 1;
|
||||
|
||||
PerformanceCounterCategory performanceCounterCategory = new PerformanceCounterCategory("Network Interface");
|
||||
|
||||
if(CardId<0 || CardId > performanceCounterCategory.GetInstanceNames().Length )
|
||||
|
||||
if (cardId < 0 || cardId > performanceCounterCategory.GetInstanceNames().Length)
|
||||
{
|
||||
Monitor.Name = "No card to monitor";
|
||||
MessageServices.Current.Publish(NETWORK_USAGE, null, Monitor);
|
||||
return;
|
||||
}
|
||||
|
||||
Monitor.Name = performanceCounterCategory.GetInstanceNames()[0];
|
||||
Monitor.Name = performanceCounterCategory.GetInstanceNames()[cardId];
|
||||
|
||||
|
||||
PerformanceCounter PC_Bandwith = new PerformanceCounter("Network Interface", "Current Bandwidth", Monitor.Name);
|
||||
@@ -749,14 +749,14 @@ public static class ThreadsFunctions
|
||||
{
|
||||
sw.Restart();
|
||||
|
||||
SumRec = 0;
|
||||
SumSen = 0;
|
||||
sumRec = 0;
|
||||
sumSen = 0;
|
||||
for (int index = 0; index < 50; index++)
|
||||
{
|
||||
SumRec += PC_RecievedBytes.NextValue();
|
||||
SumSen += PC_SentBytes.NextValue();
|
||||
sumRec += PC_RecievedBytes.NextValue();
|
||||
sumSen += PC_SentBytes.NextValue();
|
||||
}
|
||||
Monitor.Value = Math.Round(((8 * (SumSen + SumRec)) / (Monitor.Bandwidth * 50) * 100), 2) ;
|
||||
Monitor.Value = Math.Round(((8 * (sumSen + sumRec)) / (Monitor.Bandwidth * 50) * 100), 2) ;
|
||||
MessageServices.Current.Publish(NETWORK_USAGE, null, Monitor);
|
||||
sw.Stop();
|
||||
|
||||
|
||||
@@ -31,14 +31,16 @@ namespace Step.Core
|
||||
private volatile static List<Thread> RunningThreadsList = new List<Thread>();
|
||||
internal volatile static Dictionary<string, string> RunningThreadStatus = new Dictionary<string, string>();
|
||||
|
||||
private static Thread MonitorNetworkResources;
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
ThreadsFunctions.RestoreConnection();
|
||||
|
||||
// Start Thread Network monitor
|
||||
Action Monitor = new Action(ThreadsFunctions.MonitorPanelPCResources);
|
||||
Thread t = new Thread(() => Monitor());
|
||||
t.Start();
|
||||
MonitorNetworkResources = new Thread(() => Monitor());
|
||||
MonitorNetworkResources.Start();
|
||||
}
|
||||
|
||||
public static void StartWorkers()
|
||||
@@ -82,6 +84,9 @@ namespace Step.Core
|
||||
RunningThreadStatus.Clear();
|
||||
RunningThreadStatus.Add("TryNcConnection", "---");
|
||||
}
|
||||
// Close network monitor
|
||||
MonitorNetworkResources.Abort();
|
||||
|
||||
MessageServices.Current.Publish(SEND_THREADS_STATUS, null, RunningThreadStatus);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Step.Database.Controllers
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
public List<DTOAlarmHistoricModel> GetPaginatedWithFilter(string title, List<ALARM_TYPE> types, int page, int pageSize, DateTime startDate, DateTime endDate, List<int?> userIds, Dictionary<int, string> plcMessages)
|
||||
public List<DTOAlarmHistoricModel> GetPaginatedWithFilter(string title, List<ALARM_SOURCE> sources, int page, int pageSize, DateTime startDate, DateTime endDate, List<int?> userIds, Dictionary<int, string> plcMessages)
|
||||
{
|
||||
bool ifNoUser = false;
|
||||
var index = userIds.IndexOf(-1);
|
||||
@@ -55,7 +55,7 @@ namespace Step.Database.Controllers
|
||||
.Include("Users")
|
||||
.Where(x =>
|
||||
x.TimeStamp >= startDate && x.TimeStamp <= endDate // Filter by date
|
||||
&& types.Contains(x.Type) // Type
|
||||
&& sources.Contains(x.Source) // Check source
|
||||
&& ( (ifNoUser && x.Users.Count() == 0) || x.Users.Any(y => userIds.Any(z => z == y.UserId))) // Check user
|
||||
&&
|
||||
((x.Source == ALARM_SOURCE.NC && ncAlarmDescIds.Contains(x.AlarmDescriptionId.Value)) // Check if message is contained in NC messages
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Step.Model.DTOModels.AlarmModels
|
||||
public string Title { get; set; }
|
||||
|
||||
[Required]
|
||||
public List<ALARM_TYPE> Type { get; set; }
|
||||
public List<ALARM_SOURCE> Sources { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime? StartDate { get; set; }
|
||||
|
||||
@@ -6,10 +6,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Step.Model.DTOModels
|
||||
{
|
||||
public class DTONetworkMonitor
|
||||
public class DTONetworkMonitorModel
|
||||
{
|
||||
public String Name;
|
||||
public Double Bandwidth;
|
||||
public Double Value;
|
||||
public string Name { get; set; }
|
||||
public double Bandwidth { get; set; }
|
||||
public double Value { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Step.Model.DatabaseModels
|
||||
|
||||
[Key, Column("position_id", Order = 1)]
|
||||
public int PositionId { get; set; }
|
||||
|
||||
|
||||
[Column("type")]
|
||||
public byte Type { get; set; }
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace Step.UI
|
||||
}),
|
||||
MessageServices.Current.Subscribe(NETWORK_USAGE, (a, b) =>
|
||||
{
|
||||
DTONetworkMonitor NICMonitor = (DTONetworkMonitor)a;
|
||||
DTONetworkMonitorModel NICMonitor = (DTONetworkMonitorModel)a;
|
||||
if (!IsDisposed)
|
||||
Invoke((MethodInvoker)delegate ()
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Step.Controllers.WebApi
|
||||
|
||||
using (AlarmsController alarm = new AlarmsController())
|
||||
{
|
||||
var alarms = alarm.GetPaginatedWithFilter(filter.Title, filter.Type, filter.Page, filter.PageSize, filter.StartDate.Value, filter.EndDate, filter.UserIds, plcMessages);
|
||||
var alarms = alarm.GetPaginatedWithFilter(filter.Title, filter.Sources, filter.Page, filter.PageSize, filter.StartDate.Value, filter.EndDate, filter.UserIds, plcMessages);
|
||||
|
||||
return Ok(alarms);
|
||||
}
|
||||
|
||||
@@ -1339,6 +1339,7 @@
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
font-family: monospace;
|
||||
.row{
|
||||
width: 464px;
|
||||
height: 32px;
|
||||
@@ -1348,7 +1349,7 @@
|
||||
line-height: 1.78px;
|
||||
text-align: justify;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
white-space: pre;
|
||||
label{
|
||||
font-size: 18px;
|
||||
margin-left: 36px;
|
||||
|
||||
@@ -7213,6 +7213,7 @@ footer .container button.big:before {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
font-family: monospace;
|
||||
}
|
||||
.card-job-production .card-job-production-body .card-job-production-body-bottom .content-box .row {
|
||||
width: 464px;
|
||||
@@ -7223,7 +7224,7 @@ footer .container button.big:before {
|
||||
line-height: 1.78px;
|
||||
text-align: justify;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
white-space: pre;
|
||||
}
|
||||
.card-job-production .card-job-production-body .card-job-production-body-bottom .content-box .row label {
|
||||
font-size: 18px;
|
||||
|
||||
Reference in New Issue
Block a user