Fix errors on API

Change unload api url
This commit is contained in:
Lucio Maranta
2018-05-24 12:20:51 +02:00
parent d78a209eec
commit f0e483d7aa
8 changed files with 42 additions and 42 deletions
Binary file not shown.
+4 -4
View File
@@ -431,7 +431,7 @@ public static class ThreadsFunctions
ReadAxesNamesTimes++;
// Wait
Thread.Sleep(CalcSleepTime(200, (int)sw.ElapsedMilliseconds));
Thread.Sleep(CalcSleepTime(1000, (int)sw.ElapsedMilliseconds));
}
}
catch (ThreadAbortException)
@@ -497,7 +497,7 @@ public static class ThreadsFunctions
switch (cmsError.errorCode)
{
case CMS_ERROR_CODES.NC_PROD_ERROR:
Manage(ERROR_LEVEL.WARNING, cmsError.message);
Manage(ERROR_LEVEL.WARNING, cmsError.localizationKey);
break;
case CMS_ERROR_CODES.NOT_CONNECTED:
@@ -526,11 +526,11 @@ public static class ThreadsFunctions
break;
case CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND:
Manage(ERROR_LEVEL.FATAL, cmsError.message);
Manage(ERROR_LEVEL.FATAL, cmsError.localizationKey);
break;
case CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING:
Manage(ERROR_LEVEL.WARNING, cmsError.message);
Manage(ERROR_LEVEL.WARNING, cmsError.localizationKey);
TryNcConnection(); // If not connected try reconnection
break;
}
+2 -2
View File
@@ -853,9 +853,9 @@ namespace Step.NC
return numericalControl.TOOLS_WLoadToolIntoShank(shankId, positionId, toolId);
}
public CmsError UnloadTooolFromShank(int shankId, int positionId, int toolId)
public CmsError UnloadTooolFromShank(int shankId, int positionId)
{
return numericalControl.TOOLS_WUnloadToolFromShank(shankId, positionId, toolId);
return numericalControl.TOOLS_WUnloadToolFromShank(shankId, positionId);
}
#endregion
+7 -7
View File
@@ -84,7 +84,7 @@ namespace Step.Controllers.SignalR
// Call the library functions
libraryError = ncHandler.RefreshAlarm(id);
if (libraryError.IsError())
throw new HubException(libraryError.message);
throw new HubException(libraryError.localizationKey);
}
MessageServices.Current.Publish(SHOW_MSG_UI, null, "Refresh Single Alarm. ID: " + id);
@@ -99,7 +99,7 @@ namespace Step.Controllers.SignalR
// Call the library functions
libraryError = ncHandler.RestoreAlarm(id);
if (libraryError.IsError())
throw new HubException(libraryError.message);
throw new HubException(libraryError.localizationKey);
}
MessageServices.Current.Publish(SHOW_MSG_UI, null, "Recovery Alarm. ID: " + id);
@@ -114,7 +114,7 @@ namespace Step.Controllers.SignalR
// Write the click into memory
CmsError libraryError = ncHandler.PutNcSoftKeyClick((uint)id);
if (libraryError.IsError())
throw new HubException(libraryError.message);
throw new HubException(libraryError.localizationKey);
}
}
@@ -163,7 +163,7 @@ namespace Step.Controllers.SignalR
// Put value into memory
libraryError = ncHandler.PutSelectProcess(procNumber);
if (libraryError.IsError())
throw new HubException(libraryError.message);
throw new HubException(libraryError.localizationKey);
}
}
@@ -177,7 +177,7 @@ namespace Step.Controllers.SignalR
// Put value into memory
libraryError = ncHandler.PutSelectAxis(axisId);
if (libraryError.IsError())
throw new HubException(libraryError.message);
throw new HubException(libraryError.localizationKey);
}
}
@@ -192,7 +192,7 @@ namespace Step.Controllers.SignalR
// Put value into memory
libraryError = ncHandler.PutOverride(id, "plus");
if (libraryError.IsError())
throw new HubException(libraryError.message);
throw new HubException(libraryError.localizationKey);
}
}
@@ -207,7 +207,7 @@ namespace Step.Controllers.SignalR
// Put value into memory
libraryError = ncHandler.PutOverride(id, "minus");
if (libraryError.IsError())
throw new HubException(libraryError.message);
throw new HubException(libraryError.localizationKey);
}
}
}
@@ -132,7 +132,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.GetToolTableConfiguration(out ToolTableConfiguration toolTableConfiguration);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(toolTableConfiguration);
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace Step.Controllers.WebApi
if (libraryError.errorCode == CMS_ERROR_CODES.NOT_CONNECTED)
return Ok(genericData);
else
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(genericData);
}
+26 -26
View File
@@ -21,7 +21,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.GetToolTableData(out List<SiemensToolModel> tools);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(tools);
}
@@ -41,7 +41,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.AddTool(ref siemensModel);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(siemensModel);
}
@@ -63,7 +63,7 @@ namespace Step.Controllers.WebApi
CmsError libraryError = ncHandler.UpdateTool(ref siemensModel);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(siemensModel);
}
@@ -78,7 +78,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.DeleteTool(id);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -92,7 +92,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.GetFamiliesData(out List<FamilyModel> families);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(families);
}
@@ -109,7 +109,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.AddFamily(family.Name, out FamilyModel newFamily);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(newFamily);
}
@@ -127,7 +127,7 @@ namespace Step.Controllers.WebApi
CmsError libraryError = ncHandler.UpdateFamilyName(oldName, family.Name);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(family);
}
@@ -142,7 +142,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.DeleteFamily(name);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -156,7 +156,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.GetMagazinesPositionsData(out List<PositionModel> magazines);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(magazines);
}
@@ -183,7 +183,7 @@ namespace Step.Controllers.WebApi
// Update
CmsError libraryError = ncHandler.UpdateMagazinePosition(pos);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -197,7 +197,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.GetShanksData(out List<ShankModel> shanks);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(shanks);
}
@@ -216,7 +216,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.AddShank(ref shank);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(shank);
}
@@ -236,7 +236,7 @@ namespace Step.Controllers.WebApi
ncHandler.Connect();
CmsError libraryError = ncHandler.UpdateShank(ref shank);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(shank);
}
@@ -251,7 +251,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.DeleteShank(id);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -272,7 +272,7 @@ namespace Step.Controllers.WebApi
// Call library add methods
CmsError libraryError = ncHandler.AddEdge(toolId, ref edge);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(edge);
}
@@ -294,7 +294,7 @@ namespace Step.Controllers.WebApi
// Call library add methods
CmsError libraryError = ncHandler.UpdateEdge(toolId, ref edge);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(edge);
}
@@ -309,7 +309,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.DeleteEdge(toolId, edgeId);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -324,7 +324,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.GetMagazinePositionsAndTools(magazineId, out List<PositionModel> magazinePos);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(magazinePos);
}
@@ -339,7 +339,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.GetNotInMagazinesTools(out List<MountedMultiToolModel> multiTools, out List<MountedToolModel> tools);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(new
{
@@ -363,7 +363,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.LoadToolInMagazine(magazineId, libraryMag);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok(newMag);
}
@@ -382,7 +382,7 @@ namespace Step.Controllers.WebApi
// Call delete library function
CmsError libraryError = ncHandler.UnloadToolInMagazine(magazineId, positionId);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
@@ -400,14 +400,14 @@ namespace Step.Controllers.WebApi
CmsError libraryError = ncHandler.LoadTooolFromShank(shankId, positionId, toolId);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
}
[Route("shank/{shankId:int}/unload/{positionId:int}/{toolId:int}"), HttpPut]
public IHttpActionResult UnloadToolFromShank(int shankId, int positionId, int toolId)
[Route("shank/{shankId:int}/unload/{positionId:int}"), HttpPut]
public IHttpActionResult UnloadToolFromShank(int shankId, int positionId)
{
if (!ModelState.IsValid)
return BadRequest(ModelState);
@@ -416,9 +416,9 @@ namespace Step.Controllers.WebApi
{
ncHandler.Connect();
CmsError libraryError = ncHandler.UnloadTooolFromShank(shankId, positionId, toolId);
CmsError libraryError = ncHandler.UnloadTooolFromShank(shankId, positionId);
if (libraryError.IsError())
return BadRequest(libraryError.message);
return BadRequest(libraryError.localizationKey);
return Ok();
}
+1 -1
View File
@@ -150,7 +150,7 @@ export class ToolingService extends baseRestService {
}
async removeToolToShank(shank: any, model: any){
var response = await this.Put<any>(this.BASE_URL + "shank/"+ shank.id + "/unload/" + model.multitoolId + "/" + model.id, model);
var response = await this.Put<any>(this.BASE_URL + "shank/"+ shank.id + "/unload/" + model.multitoolId, model);
toolingActions.removeToolToShank(store,{shank, model});
return response;
}