From e611f6b9e8a167e713d91e1630d548480c3347db Mon Sep 17 00:00:00 2001 From: "ext_luca.pansa@cms.it" Date: Fri, 19 Feb 2021 16:36:52 +0100 Subject: [PATCH] Gestione sincronismo siemens --- CMS_CORE_Library/Siemens/Nc_Siemens.cs | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index 1f915e9..e62729f 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -4627,6 +4627,28 @@ namespace CMS_CORE_Library.Siemens return ManageException(ex); } + Thread.Sleep(100); + int response = -1; + + try + { + //Devo verificare che funzioni correttamente + DataSvc dataSvc = new DataSvc(); + //Read Machine status + Item itemToRead = new Item("/Channel/State/aTcStatus[u1, 1]"); + dataSvc.Read(itemToRead); + response = Convert.ToInt32(itemToRead.Value); + } + catch (Exception ex) + { + return ManageException(ex); + } + // 1 OK 3 ABORTED + if (response != 1 && response != 0) + { + return MAGAZINE_BUSY_ERROR; + } + // Mount temporarily till the Siemens notification arrives MoveToolInMagazineList(newMagazineTool.ToolId, magazineId, newMagazineTool.PositionId); @@ -4679,6 +4701,28 @@ namespace CMS_CORE_Library.Siemens return ManageException(ex); } + Thread.Sleep(100); + int response = -1; + + try + { + //Devo verificare che funzioni correttamente + DataSvc dataSvc = new DataSvc(); + //Read Machine status + Item itemToRead = new Item("/Channel/State/aTcStatus[u1, 1]"); + dataSvc.Read(itemToRead); + response = Convert.ToInt32(itemToRead.Value); + } + catch(Exception ex) + { + return ManageException(ex); + } + // 1 OK 3 ABORTED + if(response != 1 && response != 0) + { + return MAGAZINE_BUSY_ERROR; + } + //// Smount temporarily till the Siemens notification arrives int magPosIndex = MagazineMountedTools.FindIndex(x => x.MagazineId == magazineId && x.PositionId == positionId); if (magPosIndex >= 0)