This commit is contained in:
Lucio Maranta
2018-05-17 17:18:12 +00:00
parent 3f48a6a1de
commit 0d9a609bd7
4 changed files with 39 additions and 2 deletions
+7 -2
View File
@@ -216,8 +216,13 @@ namespace CMS_CORE_Application
List<MountedToolModel> b = null;
cmsError = N.TOOLS_RAvailableTools(ref a, ref b);
cmsError = N.TOOLS_RConfiguration(ref toolsConfig);
cmsError = N.TOOLS_WUnloadToolInMagazine(1, 1);
cmsError = N.TOOLS_WUpdatePosition(new PositionModel()
{
Disabled = false,
MagazineId = 1,
PositionId = 1
});
// cmsError = N.TOOLS_WUnloadToolInMagazine(1, 1);
// cmsError = N.TOOLS_WLoadToolInMagazine(1, new NewToolInMagazineModel() { PositionId = 2, ToolId = 19 });
//cmsError = N.PLC_WRefreshAllMessages();
//cmsError = N.PLC_RHeadsData(headsTest, 1);
@@ -1031,6 +1031,30 @@ namespace Nc_Demo_Application.Database
return null;
}
public bool UpdateToolShank(int shankId, int toolId)
{
try
{
// Find the row to be update
DataRow row = ToolsDataTable.AsEnumerable().FirstOrDefault(x => Convert.ToInt32(x["id"]) == toolId);
if (row == null)
return false;
row["shankId"] = shankId;
UpdateTool(ToolsDataTable);
}
catch (Exception ex)
{
Console.WriteLine("Update tool exception: " + ex.Message);
return false;
}
return true;
}
private void UpdateTool(DataTable tools)
{
UpdateDatabaseFromDataTable(tools, READ_TOOLS_QUERY);
@@ -187,6 +187,9 @@ namespace Nc_Demo_Application.Server.Service
[WebInvoke(Method = "PUT", UriTemplate = "tool_table/tool", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
void PutTool(ref ToolsDataModel tool);
[WebInvoke(Method = "PUT", UriTemplate = "tool_table/shank/{shankId}/tool/{toolId}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
void UpdateToolShank(string shankId, string toolId);
[WebInvoke(Method = "DELETE", UriTemplate = "tool_table/tool/{id}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
void DeleteTool(string id);
@@ -513,6 +513,11 @@ namespace Nc_Demo_Application.Server.Service
DatabaseController.getInstance().DeleteTool(Convert.ToInt32(id));
}
public void UpdateToolShank(string shankId, string toolId)
{
DatabaseController.getInstance().UpdateToolShank(Convert.ToInt32(shankId), Convert.ToInt32(toolId));
}
#endregion Tools
#region Edges