Fix positionId
WIP error hanling
This commit is contained in:
@@ -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<SiemensToolModel> 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<FamilyModel> 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<PositionModel> 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<ShankModel> 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<PositionModel> 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<MountedMultiToolModel> multiTools, out List<MountedToolModel> 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();
|
||||
|
||||
Reference in New Issue
Block a user