From 700624968d8fe051f7e2b48df73d6312c3d3a3fb Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Thu, 23 Aug 2018 12:12:14 +0200 Subject: [PATCH] Added available_tools --- .../Controllers/NcToolManagerController.cs | 9 +++++++++ Step.NC/NcHandler.cs | 4 +--- Step/Controllers/WebApi/NcFileController.cs | 3 +-- .../Controllers/WebApi/NcToolManagerController.cs | 15 +++++++++++++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Step.Database/Controllers/NcToolManagerController.cs b/Step.Database/Controllers/NcToolManagerController.cs index 50639be0..9bc50ed7 100644 --- a/Step.Database/Controllers/NcToolManagerController.cs +++ b/Step.Database/Controllers/NcToolManagerController.cs @@ -246,6 +246,15 @@ namespace Step.Database.Controllers return dtoShanks; } + public List GetAvailableTools() + { + List dtoTools = GetTools() + .Where(x => x.ShankId == null || x.ShankId == 0) + .ToList(); + + return dtoTools; + } + public DbNcToolModel AddTool(DTONewNcToolModel dtoTool) { DbNcToolModel tool = (DbNcToolModel)dtoTool; diff --git a/Step.NC/NcHandler.cs b/Step.NC/NcHandler.cs index 5ff71345..2f4e9da3 100644 --- a/Step.NC/NcHandler.cs +++ b/Step.NC/NcHandler.cs @@ -145,9 +145,7 @@ namespace Step.NC } #endregion File manager - - - + #region Read Data public CmsError GetNcGenericData(out DTONcGenericDataModel genericData) diff --git a/Step/Controllers/WebApi/NcFileController.cs b/Step/Controllers/WebApi/NcFileController.cs index 8af478c5..0f1933d3 100644 --- a/Step/Controllers/WebApi/NcFileController.cs +++ b/Step/Controllers/WebApi/NcFileController.cs @@ -96,8 +96,7 @@ namespace Step.Controllers.WebApi // Read all contents of multipart message into CustomMultipartFormDataStreamProvider. var result = await Request.Content.ReadAsMultipartAsync(provider); - - Thread.Sleep(5000); + // Send OK Response along with saved file names to the client. return Ok(); } diff --git a/Step/Controllers/WebApi/NcToolManagerController.cs b/Step/Controllers/WebApi/NcToolManagerController.cs index 0ebaf491..9cb9be8f 100644 --- a/Step/Controllers/WebApi/NcToolManagerController.cs +++ b/Step/Controllers/WebApi/NcToolManagerController.cs @@ -145,7 +145,7 @@ namespace Step.Controllers.WebApi // If option is active if (!ToolManagerConfig.FamilyOpt) { - // Copy only family + // Copy only family DTONewNcFamilyModel newFamily = new DTONewNcFamilyModel(); SupportFunctions.CopyProperties(dtoToolWithFamily, newFamily); // Update only family data @@ -469,7 +469,7 @@ namespace Step.Controllers.WebApi } [Route("magazine/available_shanks"), HttpGet] - public IHttpActionResult GetAvailableTools() + public IHttpActionResult GetAvailableShanks() { using (NcToolManagerController toolsManager = new NcToolManagerController()) { @@ -479,6 +479,17 @@ namespace Step.Controllers.WebApi } } + [Route("magazine/available_tools"), HttpGet] + public IHttpActionResult GetAvailableTools() + { + using (NcToolManagerController toolsManager = new NcToolManagerController()) + { + List tools = toolsManager.GetAvailableTools(); + + return Ok(tools); + } + } + [Route("magazine/{magazineId:int}/load/position/{positionId:int}"), HttpPut] public IHttpActionResult LoadToolInToMagazine(byte magazineId, byte positionId, [FromBody][Required] DTONcUpdateMagazineModel shankId) {