From 7f6dcbbde31f3c67ed60eded4121c99d410ccccf Mon Sep 17 00:00:00 2001 From: Lucio Maranta Date: Thu, 24 May 2018 15:41:42 +0000 Subject: [PATCH] Fix siemens and demo library --- CMS_CORE_Application/Form1.cs | 10 +- CMS_CORE_Library/DataStructures.cs | 36 +++---- CMS_CORE_Library/Demo/ILibraryService.cs | 5 +- CMS_CORE_Library/Demo/Nc_Demo.cs | 6 +- CMS_CORE_Library/Fanuc/Nc_Fanuc.cs | 4 +- CMS_CORE_Library/Nc.cs | 2 +- CMS_CORE_Library/Osai/Nc_Osai.cs | 2 +- CMS_CORE_Library/Siemens/Nc_Siemens.cs | 90 ++++++++++++------ .../Nc_Demo_Application/Nc_Demo_Db.db | Bin 77824 -> 81920 bytes .../Server/Service/ILibraryService.cs | 4 +- .../Server/Service/LibraryService.cs | 22 ++++- .../Views/DemoApplicationForm.Designer.cs | 13 +++ .../Views/DemoApplicationForm.cs | 2 +- 13 files changed, 131 insertions(+), 65 deletions(-) diff --git a/CMS_CORE_Application/Form1.cs b/CMS_CORE_Application/Form1.cs index 5febc0b..e0f01e1 100644 --- a/CMS_CORE_Application/Form1.cs +++ b/CMS_CORE_Application/Form1.cs @@ -209,6 +209,7 @@ namespace CMS_CORE_Application error = true; SetError(Lines, cmsError); } + // cmsError = N.TOOLS_WAddShank(ref newShank); // cmsError = N.TOOLS_WDeleteShank(4); //cmsError = N.TOOLS_WUpdateEdge(1, ref newEdge); @@ -223,7 +224,7 @@ namespace CMS_CORE_Application // PositionId = 1 //}); // cmsError = N.TOOLS_WUnloadToolInMagazine(1, 1); - // cmsError = N.TOOLS_WLoadToolInMagazine(1, new NewToolInMagazineModel() { PositionId = 2, ToolId = 19 }); + // cmsError = N.TOOLS_WLoadToolInMagazine(1, new NewToolInMagazineModel() { PositionId = 31, ToolId = 3 }); //cmsError = N.PLC_WRefreshAllMessages(); //cmsError = N.PLC_RHeadsData(headsTest, 1); @@ -233,10 +234,11 @@ namespace CMS_CORE_Application //cmsError = N.TOOLS_RShanksData(ref shanks); //cmsError = N.TOOLS_RFamilyData(ref famiies); //cmsError = N.TOOLS_RMagazinePositions(ref positions); - // cmsError = N.TOOLS_WAddTool(ref newTool); + cmsError = N.TOOLS_WAddTool(ref newTool); //ShankModel shank = new ShankModel(); - //cmsError = N.TOOLS_WAddShank(ref shank); + newShank.Name = newShank.Name + "1"; + cmsError = N.TOOLS_WAddShank(ref newShank); //FamilyModel family = new FamilyModel //{ // Name = "Da demo" @@ -420,7 +422,7 @@ namespace CMS_CORE_Application { this.Invoke((ThreadStart)delegate () { - Error.Text = cmsError.message; + Error.Text = cmsError.localizationKey; TXTPPLines.Text = String.Join(Environment.NewLine, Lines); Connect.Enabled = true; diff --git a/CMS_CORE_Library/DataStructures.cs b/CMS_CORE_Library/DataStructures.cs index dfa38f1..c205d55 100644 --- a/CMS_CORE_Library/DataStructures.cs +++ b/CMS_CORE_Library/DataStructures.cs @@ -286,12 +286,12 @@ namespace CMS_CORE_Library public class CmsError { public CMS_ERROR_CODES errorCode; - public string message; + public string localizationKey; public CmsError(CMS_ERROR_CODES errorCode, string message) { this.errorCode = errorCode; - this.message = message; + this.localizationKey = message; } public bool IsError() @@ -331,24 +331,26 @@ namespace CMS_CORE_Library MAX_EDGES_PER_TOOL_REACHED = 13, MAX_FAMILY_REACHED = 14, MAX_MULTITOOL_REACHED = 15, - MAX_TOOLS_PER_MULTITOOL_REACHED = 16 + MAX_TOOLS_PER_MULTITOOL_REACHED = 16, + MAG_POS_OCCUPIED = 17 } internal static CmsError NO_ERROR = new CmsError(CMS_ERROR_CODES.OK, ""); - internal static CmsError NOT_CONNECTED_ERROR = new CmsError(CMS_ERROR_CODES.NOT_CONNECTED, "CMS-Core-Error: Nc not Connected"); - internal static CmsError PROC_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Function not allowed for this type of NC"); - internal static CmsError FUNCTION_NOT_ALLOWED_ERROR = new CmsError(CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED, "CMS-Core-Error: Function not allowed for this type of NC"); - internal static CmsError BIT_NOT_IN_RANGE_ERROR = new CmsError(CMS_ERROR_CODES.BIT_NOT_IN_RANGE, "CMS-Core-Error: Bit - number must be between 0 and 7"); - internal static CmsError BYTE_NOT_IN_RANGE_ERROR = new CmsError(CMS_ERROR_CODES.BYTE_NOT_IN_RANGE, "CMS-Core-Error: Byte - number must be between 0 and 1"); - internal static CmsError INCORRECT_PARAMETERS_ERROR = new CmsError(CMS_ERROR_CODES.INCORRECT_PARAMETERS, "CMS-Core-Error: Incorrect Parameters error"); - internal static CmsError LANGUAGE_ERROR = new CmsError(CMS_ERROR_CODES.NC_LANGUAGE_ERROR, "CMS-Core-Error: Incorrect Language"); - internal static CmsError SIEMENS_ENVIRONMENT_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND, "CMS-Core-Error: Siemens Environment not found"); - internal static CmsError SIEMENS_HMI_NOT_RUNNING_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING, "CMS-Core-Error: Siemens HMI is not Running / Ready"); - internal static CmsError MAX_TOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_TOOL_REACHED, "Max tool number reached"); - internal static CmsError MAX_EDGES_PER_TOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_EDGES_PER_TOOL_REACHED, "Max edges per tool number reached"); - internal static CmsError MAX_FAMILY_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_FAMILY_REACHED, "Max family number reached"); - internal static CmsError MAX_MULTITOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_MULTITOOL_REACHED, "Max multitool number reached"); - internal static CmsError MAX_TOOLS_PER_MULTITOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_TOOLS_PER_MULTITOOL_REACHED, "Max tool per multitool number reached"); + internal static CmsError NOT_CONNECTED_ERROR = new CmsError(CMS_ERROR_CODES.NOT_CONNECTED, "error_not_connected"); + internal static CmsError PROC_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED, "error_process_not_found"); + internal static CmsError FUNCTION_NOT_ALLOWED_ERROR = new CmsError(CMS_ERROR_CODES.FUNCTION_NOT_ALLOWED, "error_function_not_allowed"); + internal static CmsError BIT_NOT_IN_RANGE_ERROR = new CmsError(CMS_ERROR_CODES.BIT_NOT_IN_RANGE, "error_bit_not_in_range"); + internal static CmsError BYTE_NOT_IN_RANGE_ERROR = new CmsError(CMS_ERROR_CODES.BYTE_NOT_IN_RANGE, "error_byte_not_in_range"); + internal static CmsError INCORRECT_PARAMETERS_ERROR = new CmsError(CMS_ERROR_CODES.INCORRECT_PARAMETERS, "error_incorrect_parameters"); + internal static CmsError INCORRECT_LANGUAGE_ERROR = new CmsError(CMS_ERROR_CODES.NC_LANGUAGE_ERROR, "error_invalid_language"); + internal static CmsError SIEMENS_ENVIRONMENT_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND, "error_siemens_enviroment_not_found_error"); + internal static CmsError SIEMENS_HMI_NOT_RUNNING_ERROR = new CmsError(CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING, "error_siemens_hmi_not_running"); + internal static CmsError MAX_TOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_TOOL_REACHED, "error_max_tool_reached"); + internal static CmsError MAX_EDGES_PER_TOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_EDGES_PER_TOOL_REACHED, "error_max_edges_per_tool_reached"); + internal static CmsError MAX_FAMILY_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_FAMILY_REACHED, "error_max_family_reached"); + internal static CmsError MAX_MULTITOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_MULTITOOL_REACHED, "error_max_multitools_reached"); + internal static CmsError MAX_TOOLS_PER_MULTITOOL_REACHED_ERROR = new CmsError(CMS_ERROR_CODES.MAX_TOOLS_PER_MULTITOOL_REACHED, "error_max_tools_per_multitool_reached"); + internal static CmsError MAG_POS_OCCUPIED_ERROR = new CmsError(CMS_ERROR_CODES.MAG_POS_OCCUPIED, "error_mag_pos_occupied"); #endregion Cms Errors Codes diff --git a/CMS_CORE_Library/Demo/ILibraryService.cs b/CMS_CORE_Library/Demo/ILibraryService.cs index f73ebe6..39a15c6 100644 --- a/CMS_CORE_Library/Demo/ILibraryService.cs +++ b/CMS_CORE_Library/Demo/ILibraryService.cs @@ -184,8 +184,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 SiemensToolModel 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 = "PUT", UriTemplate = "tool_table/shank/{shankId}/positionId/{positionId}/tool/{toolId}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] + void UpdateToolShank(string shankId, string positionId, string toolId); [WebInvoke(Method = "DELETE", UriTemplate = "tool_table/tool/{id}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] void DeleteTool(string id); diff --git a/CMS_CORE_Library/Demo/Nc_Demo.cs b/CMS_CORE_Library/Demo/Nc_Demo.cs index 78563a3..8ebf523 100644 --- a/CMS_CORE_Library/Demo/Nc_Demo.cs +++ b/CMS_CORE_Library/Demo/Nc_Demo.cs @@ -2375,7 +2375,7 @@ namespace CMS_CORE.Demo try { - serverService.UpdateToolShank(shankId.ToString(), toolId.ToString()); + serverService.UpdateToolShank(shankId.ToString(), positionId.ToString(), toolId.ToString()); } catch (Exception ex) { @@ -2385,7 +2385,7 @@ namespace CMS_CORE.Demo return NO_ERROR; } - public override CmsError TOOLS_WUnloadToolFromShank(int shankId, int positionId, int toolId) + public override CmsError TOOLS_WUnloadToolFromShank(int shankId, int positionId) { // Check if the NC Demo is Connected CmsError cmsError = CheckConnection(); @@ -2394,7 +2394,7 @@ namespace CMS_CORE.Demo try { - serverService.UpdateToolShank(0.ToString(), toolId.ToString()); + serverService.UpdateToolShank(shankId.ToString(), positionId.ToString(), 0.ToString()); } catch (Exception ex) { diff --git a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs index 63d2aba..0ca194d 100644 --- a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs +++ b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs @@ -1779,7 +1779,7 @@ namespace CMS_CORE.Fanuc { return NO_ERROR; } - public override CmsError TOOLS_WUnloadToolFromShank(int shankId, int positionId, int toolId) + public override CmsError TOOLS_WUnloadToolFromShank(int shankId, int positionId) { return NO_ERROR; } @@ -1934,7 +1934,7 @@ namespace CMS_CORE.Fanuc cmsError = NC_RParam((short)PARAM_LING_FANUC.Address, ref FanucLanguage); if (cmsError.IsError()) { - MessageBox.Show(cmsError.message); + MessageBox.Show(cmsError.localizationKey); return cmsError; } diff --git a/CMS_CORE_Library/Nc.cs b/CMS_CORE_Library/Nc.cs index 369e479..0bd8f06 100644 --- a/CMS_CORE_Library/Nc.cs +++ b/CMS_CORE_Library/Nc.cs @@ -1370,7 +1370,7 @@ namespace CMS_CORE public abstract CmsError TOOLS_WLoadToolIntoShank(int shankId, int positionId, int toolId); - public abstract CmsError TOOLS_WUnloadToolFromShank(int shankId, int positionId, int toolId); + public abstract CmsError TOOLS_WUnloadToolFromShank(int shankId, int positionId); public abstract CmsError TOOLS_GetMagazinesStatus(ref MagazineActionModel magazineAction); diff --git a/CMS_CORE_Library/Osai/Nc_Osai.cs b/CMS_CORE_Library/Osai/Nc_Osai.cs index b667a09..8ea51ec 100644 --- a/CMS_CORE_Library/Osai/Nc_Osai.cs +++ b/CMS_CORE_Library/Osai/Nc_Osai.cs @@ -2149,7 +2149,7 @@ namespace CMS_CORE.Osai return NO_ERROR; } - public override CmsError TOOLS_WUnloadToolFromShank(int shankId, int positionId, int toolId) + public override CmsError TOOLS_WUnloadToolFromShank(int shankId, int positionId) { return NO_ERROR; } diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index 016b0df..8eeef2c 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -244,7 +244,7 @@ namespace CMS_CORE.Siemens //Setup the path of NC alarms translations file filePath = PlcMessagesFilePath + "cmsalarm_" + cultureInfo.ThreeLetterISOLanguageName.ToUpper() + ".ts"; if (!File.Exists(filePath)) - return LANGUAGE_ERROR; + return INCORRECT_LANGUAGE_ERROR; // Open file reader XDocument xmlTranslationsFile; @@ -1875,8 +1875,6 @@ namespace CMS_CORE.Siemens return cmsError; try { - tool.Id = GetNextToolId(); - //Create Tools string[] piArgs = new string[6]; piArgs[0] = "/NC"; @@ -1888,6 +1886,10 @@ namespace CMS_CORE.Siemens PiSvc pi = new PiSvc(piArgs); pi.Start(); + + // Get new tool id + tool.Id = GetLastToolId(); + // Update new tool cmsError = TOOLS_WUpdateTool(ref tool); if (cmsError.IsError()) @@ -2066,8 +2068,6 @@ namespace CMS_CORE.Siemens if (MultitoolsData.Count >= MAX_MULTITOOLS_NUMBER) return INCORRECT_PARAMETERS_ERROR; - // Find new tool id - shank.Id = GetNextToolId(); //Create Shank with NC Pi service string[] piArgs = new string[8]; @@ -2084,6 +2084,8 @@ namespace CMS_CORE.Siemens PiSvc pi = new PiSvc(piArgs); pi.Start(); + // Find new tool id + shank.Id = GetLastMultitoolId(); // Update data CmsError cmsError = TOOLS_WUpdateShank(ref shank); if (cmsError.IsError()) @@ -2349,6 +2351,11 @@ namespace CMS_CORE.Siemens public override CmsError TOOLS_WLoadToolInMagazine(int magazineId, NewToolInMagazineModel newMagazineTool) { + // Check if magazine position is occupied + PositionModel magPos = MagazineMountedTools.Where(x => x.MagazineId == magazineId && x.PositionId == newMagazineTool.PositionId).FirstOrDefault(); + if (magPos != null) + return MAG_POS_OCCUPIED_ERROR; + try { //Load tool in magazine @@ -2431,7 +2438,7 @@ namespace CMS_CORE.Siemens return NO_ERROR; } - public override CmsError TOOLS_WUnloadToolFromShank(int shankId, int positionId, int toolId) + public override CmsError TOOLS_WUnloadToolFromShank(int shankId, int positionId) { try { @@ -3680,32 +3687,55 @@ namespace CMS_CORE.Siemens } } - private int GetNextToolId() + private int GetLastToolId() { - // Get tool ids - List toolIds = ToolTableData.Select(x => x.Id).ToList(); - // Sort tools ids array - toolIds.Sort((x, y) => x.CompareTo(y)); - - if (toolIds.Count == 0) - return 1; - - for (int i = 0; i < toolIds.Count - 1; i++) + Item item = new Item() { - // If next id is different than previus + 1, there is an empty space in the array of numbers - if (toolIds[i] + 1 != toolIds[i + 1]) - { - // Check if the empty space is a multitool - ShankModel shank = MultitoolsData.Where(x => x.Id == (toolIds[i] + 1)).FirstOrDefault(); - if (shank == null) - { - // return new id - return toolIds[i] + 1; - } - } - } - // If there isn't an empty space return max id + 1 - return toolIds[toolIds.Count - 1] + 1; + Path = "/Tool/Catalogue/TnumWZV" + }; + + DataSvc dataSvc = new DataSvc(); + dataSvc.Read(item); + + return Convert.ToInt32(item.Value); + + //// Get tool ids + //List toolIds = ToolTableData.Select(x => x.Id).ToList(); + //// Sort tools ids array + //toolIds.Sort((x, y) => x.CompareTo(y)); + + //if (toolIds.Count == 0) + // return 1; + + //for (int i = 0; i < toolIds.Count - 1; i++) + //{ + // // If next id is different than previus + 1, there is an empty space in the array of numbers + // if (toolIds[i] + 1 != toolIds[i + 1]) + // { + // // Check if the empty space is a multitool + // ShankModel shank = MultitoolsData.Where(x => x.Id == (toolIds[i] + 1)).FirstOrDefault(); + // if (shank == null) + // { + // // return new id + // return toolIds[i] + 1; + // } + // } + //} + //// If there isn't an empty space return max id + 1 + //return toolIds[toolIds.Count - 1] + 1; + } + + private int GetLastMultitoolId() + { + Item item = new Item() + { + Path = "/Tool/MTCatalogue/MTnumWZV" + }; + + DataSvc dataSvc = new DataSvc(); + dataSvc.Read(item); + + return Convert.ToInt32(item.Value); } private void AddOrUpdateFamilyChild(string familyName) diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Nc_Demo_Db.db b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Nc_Demo_Db.db index 5dfa380aa13d8105b143d0a7a0f16e572368cc61..d38dc9709eee29a05378ffeb059d359d0736d3b4 100644 GIT binary patch delta 2511 zcmdT_e`p(39Dncba`#@6%Qs1r-dt^$CKOxSbz7$l6f0fVj>2q9TkT(^Ih(V_rkC2J zqs)!8NzsAAjOYBvKip6pB6V&lGPDXC+TlNf6NDk73Zfu_f;h@V@x4pZHnk3%f9)lA z_qp%)bMO1>@%_$yE6vS0Uas-2A%p_#s$v&LNE*qv>~CH}t=>NzTmrY)9R=W)d)57c zyVW)83Mg*J7t%H9jBpG;k55=WZ^V_$WaEk!4B{8`SESFLkaI4Xe}?9#a!y5SZpJw+ ztv{JCCiQXsSll#5Q)xXtliKp?=^W_l80rcQbsRj>6^d@rMlGk>D(hqEc+#{|O8rQ3 zIzB$iNKx9;JJfZ!YoNtRqqcA=nW_-Rj8ys`Ok22_>1?8}N5y^_~2!#M=M!8h0T8(QJ&o=2vtse1{z|Ag}}p%y%sJ*Im}J*kcqcAg2Uc%QX*aksNcYd{!N z_P4$}UrPj85SywSkacP?>?d-dI@lsH0@Gtm2(iw-cTeH^Vza*`0F4-K!cVXYU%}__ z2`s@o@CKZQ7hw)&;29W&A?Sg2*bj}&_cc$31{7w6Z6Y{nRT)z1FGE6oWvEbZ8OjvO z&_O+AC{eWxMd~g?fw&Y*Z4<<)P}`W3&>|WmOi>aNM3fR#sB9xlWPvzJLWfggh(|05 zgo<3su&6i%E+&`=f=sYNxs(VhD;&!Of|~_j^n1wnE4wMcCIya>GT5xfr1 z!7w}k)gIr*kEQ1qH4_d75sGj_lr3W4*~6Sk9!-YKF^fP7LLF<5ftHh_&29_;UFS4EFU<6wGv`AqU-~nAFfE~iG-dp!(6Yi z?6Ol*q3@nHQo5L=Ee8(N%QlDCz^<;HDW2v288fX5VoY#^9h_nxSes+-#ZB21B}PP1 zsFN5cXrFo>5?`6(Bx&yq(gTI=?+#M&ona#3Xwb?^W8 ziLU#^JgidhzF~2JzJc zwX3}FaDMsz?W)Vlq(sxnWMVXKy)SB|$;)O7FW|-;F20oq@Ydp%26yOCwuRec#a)0q QFYXXSeI8%Pye)&Kwi delta 2363 zcma)7Z)jUp6uQ6K!sTV<2t0Wom0zc4Hl0|R{Gc=1LT@8?jwX9s_1;oWY2nit1=csx9$ zCmu{rFIrosKMuvL==c+bLo$&}@)NRn71xV1oF|HFJv=}Ca>y>u?&J+oOi7oC6NhQ< zc$`mkFTBvruX+2`n1$9tr%WUg{A644vz@%JcxNyFYQd8H5A}f?a${jwWbiwD16Sb( zScLcC#rde41-*TIk2b)Iy*qeY;(moroaeIH!~4{D1Dfg7p>%xyle>GKtCQAwX05?F zc-EeGE;||Pyxn1U%-7GvZ9Xx*{p?+WJ&qr(uBxqzN6fkw`vz<02Itc=bIl;Ej!+vT zmvg1m^y#@<=C7aK7Q2tRjKPY15Z;DuU^q9OCFdP$>c1xDK49fr9*#5Cf}1MCP|85W zp;Trxdn~&(lO0LdWb6VvSCtYY%4AhalqkdNDfvJompFavIROd~rL`)>$s|Rb83}F( z|170rslFrWql1D?!XCc6vO|8OBik9c!pAF|jVKmTo~lYQiPBw_63OI|v!yD>z-`!S zRf;0YwW<_Jlnrh%Sbv>3!E0>Vi`r-?YXc=$8jp@JQHkxK5Pb;H+Ad0F}Esb)RS zRDz>eIY&v6w1`8?gF;J*@YZlVj|@-H9)%bWAQ5c4&;W2mwc44pn=H!i#PPI}Y zAq_#M;zDR3HMB7SP1WjN8AU|Z_?Dq!zNJ*ux1@4?OIP4qVdeN%NZG!nDa*G6NK@x| zDuR%aQnZLPN`@g-$x!eo14=}KXDLbFb0wA1JqFi>441fJCb{k@hw8{Ee?!>t64OBm zI0FjW;R+1FZn%Tiy)j?!{^;bJ%H3U&M4;?!QbJ?k(&#Yi zF=+Mbh4MZy8j~i&*1`IqoDZaPxwH_VOopB4Rn6$n<+5PV7xZq&XMgrs8q4EWeu%uV z_scUbcV&e1sZAeD2_Dq t?FT~| tools); + tools = tools.Where(x => x.ShanksId == Convert.ToInt32(shankId)).ToList(); + + if(tools == null) + throw new WebFaultException(HttpStatusCode.NotFound); + + if(tools.Count < Convert.ToInt32(positionId)) + throw new WebFaultException(HttpStatusCode.BadRequest); + + tools[Convert.ToInt32(positionId) - 1].ShanksId = 0; + + DatabaseController.getInstance().UpdateToolData(tools[Convert.ToInt32(positionId) - 1]); + } } #endregion Tools diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.Designer.cs b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.Designer.cs index 9b1d233..09ad62f 100644 --- a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.Designer.cs +++ b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.Designer.cs @@ -228,6 +228,7 @@ namespace Nc_Demo_Application this.removeTool = new System.Windows.Forms.ToolStripButton(); this.addTool = new System.Windows.Forms.ToolStripButton(); this.stopServer = new System.Windows.Forms.Button(); + this.versionLabel = new System.Windows.Forms.Label(); this.ncDataPage.SuspendLayout(); this.toolStrip5.SuspendLayout(); this.ncTabControl.SuspendLayout(); @@ -2046,11 +2047,22 @@ namespace Nc_Demo_Application this.stopServer.UseVisualStyleBackColor = true; this.stopServer.Click += new System.EventHandler(this.StopServer_Click); // + // versionLabel + // + this.versionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.versionLabel.AutoSize = true; + this.versionLabel.Location = new System.Drawing.Point(843, 696); + this.versionLabel.Name = "versionLabel"; + this.versionLabel.Size = new System.Drawing.Size(57, 13); + this.versionLabel.TabIndex = 11; + this.versionLabel.Text = "Version:26"; + // // DemoApplicationForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1008, 730); + this.Controls.Add(this.versionLabel); this.Controls.Add(this.serverStatusLabel); this.Controls.Add(this.ncTabControl); this.Controls.Add(this.stopServer); @@ -2304,6 +2316,7 @@ namespace Nc_Demo_Application private System.Windows.Forms.TextBox magActionOrigMag; private System.Windows.Forms.Label label21; private System.Windows.Forms.ComboBox magActionAction; + private System.Windows.Forms.Label versionLabel; } } diff --git a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.cs b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.cs index 74deaab..e4bdfb7 100644 --- a/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.cs +++ b/CMS_CORE_Nc_Demo_Application/Nc_Demo_Application/Views/DemoApplicationForm.cs @@ -41,7 +41,7 @@ namespace Nc_Demo_Application private void ShowServer(bool visible) { - ncTabControl.Visible = stopServer.Visible = serverStatusLabel.Visible = visible; + ncTabControl.Visible = stopServer.Visible = serverStatusLabel.Visible = versionLabel.Visible = visible; startupPanel.Visible = !visible; }