Fix shanks
Osai: on startup check directory
This commit is contained in:
@@ -284,18 +284,28 @@ namespace Step.Controllers.WebApi
|
||||
}
|
||||
}
|
||||
|
||||
[Route("shank"), HttpPost]
|
||||
public IHttpActionResult AddShank([FromBody][Required] DTONewNcShankModel dtoShank)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(ModelState);
|
||||
[Route("shank/{shankId:int}"), HttpPost]
|
||||
public IHttpActionResult AddShank(short shankId)
|
||||
{
|
||||
using (NcToolManagerController toolsManager = new NcToolManagerController())
|
||||
{
|
||||
// Check if exists a tool with the same id
|
||||
DbNcShankModel dbShank = toolsManager.FindShank(shankId);
|
||||
if (dbShank != null)
|
||||
return BadRequest(API_ERROR_KEYS.ID_ALREADY_EXIST);
|
||||
}
|
||||
|
||||
if (!ToolManagerConfig.ShankOpt)
|
||||
return BadRequest(API_ERROR_KEYS.OPTION_NOT_ACTIVE);
|
||||
|
||||
using (NcToolManagerController toolsManager = new NcToolManagerController())
|
||||
{
|
||||
DTONcShankModel shank = (DTONcShankModel)toolsManager.AddShank(dtoShank);
|
||||
{
|
||||
DTONewNcShankModel dtoShank = new DTONewNcShankModel()
|
||||
{
|
||||
Balluf = 0,
|
||||
MagazinePositionType = 0
|
||||
};
|
||||
DTONcShankModel shank = (DTONcShankModel)toolsManager.AddShank(dtoShank, shankId);
|
||||
|
||||
return Ok(shank);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user