diff --git a/Libs/CMS_CORE_Library.dll b/Libs/CMS_CORE_Library.dll index 0ecc73ec..658bcdc2 100644 Binary files a/Libs/CMS_CORE_Library.dll and b/Libs/CMS_CORE_Library.dll differ diff --git a/Step/Controllers/WebApi/ConfigurationController.cs b/Step/Controllers/WebApi/ConfigurationController.cs index 0b32d770..432e2b6f 100644 --- a/Step/Controllers/WebApi/ConfigurationController.cs +++ b/Step/Controllers/WebApi/ConfigurationController.cs @@ -132,7 +132,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.GetToolTableConfiguration(out ToolTableConfiguration toolTableConfiguration); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(toolTableConfiguration); diff --git a/Step/Controllers/WebApi/ToolTableController.cs b/Step/Controllers/WebApi/ToolTableController.cs index d94ecb1f..30222b02 100644 --- a/Step/Controllers/WebApi/ToolTableController.cs +++ b/Step/Controllers/WebApi/ToolTableController.cs @@ -18,15 +18,11 @@ namespace Step.Controllers.WebApi { using (NcHandler ncHandler = new NcHandler()) { - ncHandler.Connect(); - Stopwatch sw = new Stopwatch(); - sw.Start(); CmsError libraryError = ncHandler.GetToolTableData(out List tools); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); - Console.WriteLine(sw.ElapsedMilliseconds); + return Ok(tools); } } @@ -45,7 +41,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.AddTool(ref siemensModel); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(siemensModel); @@ -68,7 +63,6 @@ namespace Step.Controllers.WebApi CmsError libraryError = ncHandler.UpdateTool(ref siemensModel); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(siemensModel); @@ -84,7 +78,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.DeleteTool(id); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -99,7 +92,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.GetFamiliesData(out List families); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(families); @@ -117,7 +109,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.AddFamily(family.Name, out FamilyModel newFamily); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(newFamily); @@ -136,7 +127,6 @@ namespace Step.Controllers.WebApi CmsError libraryError = ncHandler.UpdateFamilyName(oldName, family.Name); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(family); @@ -152,7 +142,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.DeleteFamily(name); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -167,7 +156,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.GetMagazinesPositionsData(out List magazines); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(magazines); @@ -195,7 +183,6 @@ namespace Step.Controllers.WebApi // Update CmsError libraryError = ncHandler.UpdateMagazinePosition(pos); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -210,7 +197,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.GetShanksData(out List shanks); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(shanks); @@ -230,7 +216,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.AddShank(ref shank); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(shank); @@ -251,7 +236,6 @@ namespace Step.Controllers.WebApi ncHandler.Connect(); CmsError libraryError = ncHandler.UpdateShank(ref shank); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(shank); @@ -267,7 +251,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.DeleteShank(id); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -289,7 +272,6 @@ namespace Step.Controllers.WebApi // Call library add methods CmsError libraryError = ncHandler.AddEdge(toolId, ref edge); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(edge); @@ -312,7 +294,6 @@ namespace Step.Controllers.WebApi // Call library add methods CmsError libraryError = ncHandler.UpdateEdge(toolId, ref edge); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(edge); @@ -328,7 +309,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.DeleteEdge(toolId, edgeId); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -344,7 +324,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.GetMagazinePositionsAndTools(magazineId, out List magazinePos); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(magazinePos); @@ -360,7 +339,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.GetNotInMagazinesTools(out List multiTools, out List tools); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(new @@ -385,7 +363,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.LoadToolInMagazine(magazineId, libraryMag); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(newMag); @@ -405,7 +382,6 @@ namespace Step.Controllers.WebApi // Call delete library function CmsError libraryError = ncHandler.UnloadToolInMagazine(magazineId, positionId); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -424,7 +400,6 @@ namespace Step.Controllers.WebApi CmsError libraryError = ncHandler.LoadTooolFromShank(shankId, positionId, toolId); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok(); @@ -443,7 +418,6 @@ namespace Step.Controllers.WebApi CmsError libraryError = ncHandler.UnloadTooolFromShank(shankId, positionId, toolId); if (libraryError.IsError()) - if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED) return BadRequest(libraryError.message); return Ok();