Fanuc TT
& alarm Fixes
This commit is contained in:
@@ -8,6 +8,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using static Step.Model.Constants;
|
||||
using static Step.Config.ServerConfig;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Step.Database.Controllers
|
||||
{
|
||||
@@ -47,21 +48,19 @@ namespace Step.Database.Controllers
|
||||
.OrderBy(x => x.AlarmOccurrenceId)
|
||||
.Include("Users")
|
||||
.Where(x =>
|
||||
x.TimeStamp >= startDate && x.TimeStamp <= endDate
|
||||
&& types.Contains(x.Type)
|
||||
&& x.Users.Any(y => userIds.Any(z => z == y.UserId))
|
||||
x.TimeStamp >= startDate && x.TimeStamp <= endDate // Filter by date
|
||||
&& types.Contains(x.Type) // Type
|
||||
&& x.Users.Any(y => userIds.Any(z => z == y.UserId)) // Check user
|
||||
&&
|
||||
((x.Source == ALARM_SOURCE.NC && ncAlarmDescIds.Contains(x.AlarmDescriptionId.Value))
|
||||
|| (x.Source == ALARM_SOURCE.PLC && plcAlarmDescIds.Contains(x.PlcMessageId.Value)))
|
||||
);
|
||||
|
||||
var occurrences = occurrencesQuery
|
||||
.Skip(page * pageSize)
|
||||
.Take(pageSize)
|
||||
.Include("AlarmDescription")
|
||||
.ToList();
|
||||
((x.Source == ALARM_SOURCE.NC && ncAlarmDescIds.Contains(x.AlarmDescriptionId.Value)) // Check if message is contained in NC messages
|
||||
|| (x.Source == ALARM_SOURCE.PLC && plcAlarmDescIds.Contains(x.PlcMessageId.Value))) // Check if message is contained in PLC messages
|
||||
)
|
||||
.Skip(page * pageSize) // Paginate
|
||||
.Take(pageSize)
|
||||
.Include("AlarmDescription") // Include foreign key
|
||||
.ToList();
|
||||
|
||||
return occurrences
|
||||
return occurrencesQuery
|
||||
.Select(x => (DTOAlarmHistoricModel)x)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user