Added new shanks data

Added isEnabled tool field
This commit is contained in:
Lucio Maranta
2018-05-04 17:06:25 +02:00
parent 17370e29c9
commit d2b88a6992
6 changed files with 74 additions and 10 deletions
Binary file not shown.
@@ -0,0 +1,39 @@
using System.Collections.Generic;
using static CMS_CORE_Library.DataStructures;
namespace Step.Model.DTOModels.ToolModels
{
public class DTOShankModel
{
public int Id;
public string Name;
public bool IsEnabled;
public bool IsInhibited;
public bool InChangeTool;
public bool InFixedPlace;
public bool InUse;
public int LeftSize;
public int RightSize;
public int MagazinePositionType;
public List<ShankChildModel> ChildsTools;
public static explicit operator ShankModel(DTOShankModel obj)
{
return new ShankModel()
{
Id = 0,
Name = obj.Name,
IsEnabled = obj.IsEnabled,
IsInhibited = obj.IsInhibited,
InChangeTool = obj.InChangeTool,
InFixedPlace = obj.InFixedPlace,
InUse = obj.InUse,
LeftSize = obj.LeftSize,
RightSize = obj.RightSize,
MagazinePositionType = obj.MagazinePositionType,
ChildsTools = obj.ChildsTools
};
}
}
}
@@ -33,7 +33,7 @@ namespace Step.Model.DTOModels.ToolModels
public bool IsActive;
[Required]
public bool FixedPlace;
public bool InFixedPlace;
[Required]
public bool IsInhibited;
@@ -42,7 +42,7 @@ namespace Step.Model.DTOModels.ToolModels
public bool IsMeasured;
[Required]
public bool ChangeTool;
public bool InChangeTool;
[Required]
public bool IsInUse;
+1
View File
@@ -101,6 +101,7 @@
<Compile Include="DTOModels\DTOStartupConfigurationModel.cs" />
<Compile Include="DTOModels\DTOUserModel.cs" />
<Compile Include="DTOModels\ToolModels\DTOEdgeModel.cs" />
<Compile Include="DTOModels\ToolModels\DTOShankModel.cs" />
<Compile Include="DTOModels\ToolModels\DTOSiemensToolModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="DatabaseModels\UserModel.cs">
+7 -3
View File
@@ -752,13 +752,17 @@ namespace Step.NC
return numericalControl.TOOLS_WAddFamily(ref family);
}
public CmsError AddShank(out ShankModel shank)
public CmsError AddShank(ref ShankModel shank)
{
shank = new ShankModel();
return numericalControl.TOOLS_WAddShank(ref shank);
}
public CmsError UpdateShank(ref ShankModel shank)
{
return numericalControl.TOOLS_WUpdateShank(ref shank);
}
public CmsError UpdateFamilyName(string oldName, string newName)
{
return numericalControl.TOOLS_WUpdateFamilyData(oldName, newName);
+25 -5
View File
@@ -102,8 +102,8 @@ namespace Step.Controllers.WebApi
IsInhibited = dtoModel.IsInhibited,
IsInUse = dtoModel.IsInUse,
IsMeasured = dtoModel.IsMeasured,
ChangeTool = dtoModel.ChangeTool,
FixedPlace = dtoModel.FixedPlace,
InChangeTool = dtoModel.InChangeTool,
InFixedPlace = dtoModel.InFixedPlace,
PreAlarm = dtoModel.PreAlarm,
Cooling1 = dtoModel.Cooling1,
@@ -251,12 +251,14 @@ namespace Step.Controllers.WebApi
}
[Route("shank"), HttpPost]
public IHttpActionResult AddShank()
public IHttpActionResult AddShank([FromBody] DTOShankModel dtoShank)
{
using (NcHandler ncHandler = new NcHandler())
{
ShankModel shank = (ShankModel)dtoShank;
ncHandler.Connect();
CmsError libraryError = ncHandler.AddShank(out ShankModel shank);
CmsError libraryError = ncHandler.AddShank(ref shank);
if (libraryError.IsError())
if (libraryError.errorCode != CMS_ERROR_CODES.NOT_CONNECTED)
return BadRequest(libraryError.message);
@@ -264,7 +266,25 @@ namespace Step.Controllers.WebApi
return Ok(shank);
}
}
[Route("shank/{shankId:int}"), HttpPut]
public IHttpActionResult UpdateShank(int shankId, [FromBody] DTOShankModel dtoShank)
{
using (NcHandler ncHandler = new NcHandler())
{
ShankModel shank = (ShankModel)dtoShank;
shank.Id = shankId;
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);
}
}
[Route("shank/{id:int}"), HttpDelete]
public IHttpActionResult DeleteShank(int id)
{