diff --git a/Step.Config/ServerConfigController.cs b/Step.Config/ServerConfigController.cs index 672400cb..ce6e86c1 100644 --- a/Step.Config/ServerConfigController.cs +++ b/Step.Config/ServerConfigController.cs @@ -30,7 +30,7 @@ namespace Step.Config ReadToolManagerConfig(); ReadMacros(); } - catch (System.Xml.XmlException ex) + catch (XmlException ex) { ExceptionManager.Manage(ERROR_LEVEL.FATAL, "Error while reading file: " + ex.SourceUri + @@ -61,7 +61,7 @@ namespace Step.Config // Open file reader XDocument xmlConfigFile = XDocument.Load(BASE_PATH + "\\" + configFilePath); // Validate file - xmlConfigFile.Validate(readerSettings, ValidationHandler); + xmlConfigFile.Validate(readerSettings, ValidationHandler, true); return xmlConfigFile; } @@ -125,7 +125,10 @@ namespace Step.Config } else if (e.Severity == XmlSeverityType.Error) { - ExceptionManager.Manage(ERROR_LEVEL.FATAL, e.Message); + ExceptionManager.Manage(ERROR_LEVEL.FATAL, + "Error while reading file: " + e.Exception.SourceUri + + "\n Error: " + e.Message + ); } } diff --git a/Step.Database/Controllers/AlarmsController.cs b/Step.Database/Controllers/AlarmsController.cs index b405a892..3ac43f9c 100644 --- a/Step.Database/Controllers/AlarmsController.cs +++ b/Step.Database/Controllers/AlarmsController.cs @@ -45,13 +45,13 @@ namespace Step.Database.Controllers return paginated; } - public List GetPaginatedWithFilter(int page, int pageSize, DateTime startDate, DateTime endDate, List userIds) + public List GetPaginatedWithFilter(string message, ALARM_TYPE type, int page, int pageSize, DateTime startDate, DateTime endDate, List userIds) { var occurrences = dbCtx .AlarmOccurrences .OrderBy(x => x.AlarmOccurrenceId) .Where(x => - x.TimeStamp >= startDate && x.TimeStamp <= endDate + x.TimeStamp >= startDate && x.TimeStamp <= endDate // && userIds.Any(y => x.Users.Select(z => z.UserId).Any(z => z == y)) ) .Skip(page * pageSize) diff --git a/Step.Model/DTOModels/AlarmModels/DTOAlarmHistoricModel.cs b/Step.Model/DTOModels/AlarmModels/DTOAlarmHistoricModel.cs index fbcfdb26..e25cb690 100644 --- a/Step.Model/DTOModels/AlarmModels/DTOAlarmHistoricModel.cs +++ b/Step.Model/DTOModels/AlarmModels/DTOAlarmHistoricModel.cs @@ -57,6 +57,8 @@ namespace Step.Model.DTOModels.AlarmModels { public int Page; public int PageSize; + public string Title; + public ALARM_TYPE Type; public DateTime StartDate; public DateTime EndDate; public List UserIds; diff --git a/Step.NC/NcHandler.cs b/Step.NC/NcHandler.cs index a5b31ce3..1d9b6adb 100644 --- a/Step.NC/NcHandler.cs +++ b/Step.NC/NcHandler.cs @@ -95,7 +95,7 @@ namespace Step.NC if (cmsError.IsError()) return cmsError; - // If the program is a job + // JOB CASE if (program == PROGRAM_TYPE_ENUM.JOB) { // Get selected process @@ -121,6 +121,7 @@ namespace Step.NC return NO_ERROR; } + // PART PROGRAM CASE else { if (File.Exists(path)) diff --git a/Step/App_Start/SignalRContractResolver.cs b/Step/App_Start/SignalRContractResolver.cs index 8ec35bfc..15487066 100644 --- a/Step/App_Start/SignalRContractResolver.cs +++ b/Step/App_Start/SignalRContractResolver.cs @@ -26,6 +26,5 @@ namespace Step.App_Start return _camelCaseContractResolver.ResolveContract(type); } - } } diff --git a/Step/Controllers/WebApi/ApiAlarmController.cs b/Step/Controllers/WebApi/ApiAlarmController.cs index a5e8620b..5f1899d3 100644 --- a/Step/Controllers/WebApi/ApiAlarmController.cs +++ b/Step/Controllers/WebApi/ApiAlarmController.cs @@ -18,23 +18,23 @@ namespace Step.Controllers.WebApi [RoutePrefix("api/alarm")] public class ApiAlarmController : ApiController { - [Route(""), HttpGet] - public IHttpActionResult GetAll(int page, int pageSize) - { - using (AlarmsController alarm = new AlarmsController()) - { - var a = alarm.GetPaginated(page, pageSize); + //[Route(""), HttpGet] + //public IHttpActionResult GetAll(int page, int pageSize) + //{ + // using (AlarmsController alarm = new AlarmsController()) + // { + // var a = alarm.GetPaginated(page, pageSize); - return Ok(a); - } - } + // return Ok(a); + // } + //} [Route("paginated"), HttpPost] public IHttpActionResult GetFiltered([FromBody]DTOAlarmsFilterModel data) { using (AlarmsController alarm = new AlarmsController()) { - var alarms = alarm.GetPaginatedWithFilter(data.Page - 1, data.PageSize, data.StartDate, data.EndDate, data.UserIds); + var alarms = alarm.GetPaginatedWithFilter(data.Title, data.Type, data.Page - 1, data.PageSize, data.StartDate, data.EndDate, data.UserIds); return Ok(alarms); } diff --git a/Step/Controllers/WebApi/NcFileController.cs b/Step/Controllers/WebApi/NcFileController.cs index 466f8648..f7208079 100644 --- a/Step/Controllers/WebApi/NcFileController.cs +++ b/Step/Controllers/WebApi/NcFileController.cs @@ -138,14 +138,12 @@ namespace Step.Controllers.WebApi public IHttpActionResult GetSharedFolderFileList(string sharedPath) { List filelist = new List(); - + // NC - PC shared folder path string sharedFullPath = NcConfig.SharedPath + sharedPath; if (!Directory.Exists(sharedFullPath)) - { return NotFound(); - } - + // Create list of directories foreach (string item in Directory.GetDirectories(sharedFullPath)) { filelist.Add(new @@ -158,7 +156,7 @@ namespace Step.Controllers.WebApi } string sharedNcPath = NcConfig.SharedName + sharedPath.Replace('\\', '/'); - + // Add files to list foreach (string item in Directory.GetFiles(sharedFullPath)) { if (VALID_FILE_EXTENSIONS.Contains(Path.GetExtension(item).ToLower())) @@ -191,6 +189,7 @@ namespace Step.Controllers.WebApi { if (item.IsAFile) { + // Get part program under "file" key if (item.ParameterName == "file") { using (NcHandler ncHandler = new NcHandler()) @@ -204,7 +203,7 @@ namespace Step.Controllers.WebApi // Check if reps parameter is null or isn't a valid int if (repsParam == null || !Int32.TryParse(repsParam.Value, out int reps)) return BadRequest(); - + // Upload CmsError cmsError = ncHandler.UploadPartProgramAndAddToQueue(QUEUE_TMP_FOLDER, item.FileName, reps, out queueItem); if (cmsError.IsError()) return BadRequest(cmsError.localizationKey); diff --git a/Step/program.cs b/Step/program.cs index 32019851..2169fe7c 100644 --- a/Step/program.cs +++ b/Step/program.cs @@ -91,10 +91,10 @@ namespace Step ServerControlWindow.Stop(); } - private static bool ValidateAddress(String Addr) + private static bool ValidateAddress(string Addr) { //If is an asterisk is OK - if (String.IsNullOrWhiteSpace(Addr) || Addr == "*") + if (string.IsNullOrWhiteSpace(Addr) || Addr == "*") return true; //Find an IP Address