|
@@ -66,184 +66,198 @@ namespace Fanuc_HttpServer.hedidenain
|
|
|
Machine = machineList.Where(m => m.Key == requestBody.machineName).FirstOrDefault().Value;
|
|
|
if (Machine != null)
|
|
|
{
|
|
|
- if (Machine.GetState().ToString() == "DNC_STATE_MACHINE_IS_AVAILABLE")
|
|
|
+ try
|
|
|
{
|
|
|
- responseBody.deviceState = ON_LINE_STATE;
|
|
|
- JHError m_Error = Machine.GetInterface(HeidenhainDNCLib.DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHERROR);
|
|
|
- JHErrorEntry2List errorsList = m_Error.GetErrorList();
|
|
|
- IJHErrorEntry2 pErrorEntry = null;
|
|
|
- for (int i = 0; i < errorsList.Count; i++)
|
|
|
+ if (Machine.GetState().ToString() == "DNC_STATE_MACHINE_IS_AVAILABLE")
|
|
|
{
|
|
|
- pErrorEntry = errorsList[i];
|
|
|
- if (pErrorEntry != null && pErrorEntry.Text != null)
|
|
|
+ responseBody.deviceState = ON_LINE_STATE;
|
|
|
+ JHError m_Error = Machine.GetInterface(HeidenhainDNCLib.DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHERROR);
|
|
|
+ JHErrorEntry2List errorsList = m_Error.GetErrorList();
|
|
|
+ IJHErrorEntry2 pErrorEntry = null;
|
|
|
+ for (int i = 0; i < errorsList.Count; i++)
|
|
|
{
|
|
|
- //Console.WriteLine("===" + pErrorEntry.Text.ToString());
|
|
|
- responseBody.errorsInfo += pErrorEntry.Text.ToString() + " ";
|
|
|
+ pErrorEntry = errorsList[i];
|
|
|
+ if (pErrorEntry != null && pErrorEntry.Text != null)
|
|
|
+ {
|
|
|
+ //Console.WriteLine("===" + pErrorEntry.Text.ToString());
|
|
|
+ responseBody.errorsInfo += pErrorEntry.Text.ToString() + " ";
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if (fun == ActionTypeEnum.Collect.ToString())
|
|
|
- {
|
|
|
|
|
|
- JHAutomatic m_Automatic = Machine.GetInterface(DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHAUTOMATIC);
|
|
|
-
|
|
|
- JHProcessData m_ProcessData = Machine.GetInterface(HeidenhainDNCLib.DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHPROCESSDATA);
|
|
|
-
|
|
|
-
|
|
|
- object pFeed = new object();
|
|
|
- object pSpeed = new object();
|
|
|
- object pRapid = new object();
|
|
|
- object proStatus = new object();
|
|
|
- //进出倍率 主轴倍率
|
|
|
- m_Automatic.GetOverrideInfo(ref pFeed, ref pSpeed, ref pRapid);
|
|
|
- //主程序
|
|
|
- object pSelectedProgram = new object(); ;
|
|
|
- m_Automatic.GetExecutionPoint(ref pSelectedProgram);
|
|
|
- responseBody.mainProg = pSelectedProgram.ToString();
|
|
|
-
|
|
|
- m_Automatic.GetExecutionMode();
|
|
|
- DNC_STS_PROGRAM dncProgram = m_Automatic.GetProgramStatus();
|
|
|
-
|
|
|
- RunDatasInfo runDatasInfo = new RunDatasInfo();
|
|
|
- responseBody.feedRateOvr = pFeed.ToString();
|
|
|
- responseBody.spindleMagnification = pSpeed.ToString();
|
|
|
- //responseBody.actSpindle = pRapid.ToString();
|
|
|
- //计算开机时长
|
|
|
- object oHours = new object();
|
|
|
- object oMinutes = new object();
|
|
|
- // --- NC uptime --------------------------------------------------------------------------
|
|
|
- m_ProcessData.GetNcUpTime(ref oHours, ref oMinutes);
|
|
|
- string ncUpTime = oHours.ToString() + ":" + (Convert.ToInt32(oMinutes) > 9 ? oMinutes.ToString() : ("0" + oMinutes.ToString()));
|
|
|
-
|
|
|
- // --- Machine uptime ---------------------------------------------------------------------
|
|
|
- m_ProcessData.GetMachineUpTime(ref oHours, ref oMinutes);
|
|
|
- string machineUpTime = oHours.ToString() + ":" + (Convert.ToInt32(oMinutes) > 9 ? oMinutes.ToString() : ("0" + oMinutes.ToString()));
|
|
|
- // --- Machine running time ---------------------------------------------------------------
|
|
|
- m_ProcessData.GetMachineRunningTime(ref oHours, ref oMinutes);
|
|
|
- string runningTimes = oHours.ToString() + ":" + (Convert.ToInt32(oMinutes) > 9 ? oMinutes.ToString() : ("0" + oMinutes.ToString()));
|
|
|
-
|
|
|
- responseBody.powerOnTime = (Convert.ToInt32(oHours) * 60 + Convert.ToInt32(oMinutes)).ToString();
|
|
|
-
|
|
|
- JHDataAccess m_DataAccess = Machine.GetInterface(HeidenhainDNCLib.DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHDATAACCESS);
|
|
|
- HeidenhainDNCLib.DNC_ACCESS_MODE accessModeEnum = (HeidenhainDNCLib.DNC_ACCESS_MODE)Enum.Parse(typeof(HeidenhainDNCLib.DNC_ACCESS_MODE), "DNC_ACCESS_MODE_PLCDATAACCESS");
|
|
|
- m_DataAccess.SetAccessMode(accessModeEnum, "807667");
|
|
|
- List<string> param = jcIpDict[ip];
|
|
|
- for (int j = 0; j < param.Count; j++)
|
|
|
+ if (fun == ActionTypeEnum.Collect.ToString())
|
|
|
{
|
|
|
- IJHDataEntry m_DataEntry = m_DataAccess.GetDataEntry(param[j]);
|
|
|
- IJHDataEntryPropertyList dataEntryPropertyList = m_DataEntry.propertyList;
|
|
|
- for (int i = 0; i < dataEntryPropertyList.Count; i++)
|
|
|
+
|
|
|
+ JHAutomatic m_Automatic = Machine.GetInterface(DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHAUTOMATIC);
|
|
|
+
|
|
|
+ JHProcessData m_ProcessData = Machine.GetInterface(HeidenhainDNCLib.DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHPROCESSDATA);
|
|
|
+
|
|
|
+
|
|
|
+ object pFeed = new object();
|
|
|
+ object pSpeed = new object();
|
|
|
+ object pRapid = new object();
|
|
|
+ object proStatus = new object();
|
|
|
+ //进出倍率 主轴倍率
|
|
|
+ m_Automatic.GetOverrideInfo(ref pFeed, ref pSpeed, ref pRapid);
|
|
|
+ //主程序
|
|
|
+ object pSelectedProgram = new object(); ;
|
|
|
+ m_Automatic.GetExecutionPoint(ref pSelectedProgram);
|
|
|
+ responseBody.mainProg = pSelectedProgram.ToString();
|
|
|
+
|
|
|
+ m_Automatic.GetExecutionMode();
|
|
|
+ DNC_STS_PROGRAM dncProgram = m_Automatic.GetProgramStatus();
|
|
|
+
|
|
|
+ RunDatasInfo runDatasInfo = new RunDatasInfo();
|
|
|
+ responseBody.feedRateOvr = pFeed.ToString();
|
|
|
+ responseBody.spindleMagnification = pSpeed.ToString();
|
|
|
+ //responseBody.actSpindle = pRapid.ToString();
|
|
|
+ //计算开机时长
|
|
|
+ object oHours = new object();
|
|
|
+ object oMinutes = new object();
|
|
|
+ // --- NC uptime --------------------------------------------------------------------------
|
|
|
+ m_ProcessData.GetNcUpTime(ref oHours, ref oMinutes);
|
|
|
+ string ncUpTime = oHours.ToString() + ":" + (Convert.ToInt32(oMinutes) > 9 ? oMinutes.ToString() : ("0" + oMinutes.ToString()));
|
|
|
+
|
|
|
+ // --- Machine uptime ---------------------------------------------------------------------
|
|
|
+ m_ProcessData.GetMachineUpTime(ref oHours, ref oMinutes);
|
|
|
+ string machineUpTime = oHours.ToString() + ":" + (Convert.ToInt32(oMinutes) > 9 ? oMinutes.ToString() : ("0" + oMinutes.ToString()));
|
|
|
+ // --- Machine running time ---------------------------------------------------------------
|
|
|
+ m_ProcessData.GetMachineRunningTime(ref oHours, ref oMinutes);
|
|
|
+ string runningTimes = oHours.ToString() + ":" + (Convert.ToInt32(oMinutes) > 9 ? oMinutes.ToString() : ("0" + oMinutes.ToString()));
|
|
|
+
|
|
|
+ responseBody.powerOnTime = (Convert.ToInt32(oHours) * 60 + Convert.ToInt32(oMinutes)).ToString();
|
|
|
+
|
|
|
+ JHDataAccess m_DataAccess = Machine.GetInterface(HeidenhainDNCLib.DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHDATAACCESS);
|
|
|
+ HeidenhainDNCLib.DNC_ACCESS_MODE accessModeEnum = (HeidenhainDNCLib.DNC_ACCESS_MODE)Enum.Parse(typeof(HeidenhainDNCLib.DNC_ACCESS_MODE), "DNC_ACCESS_MODE_PLCDATAACCESS");
|
|
|
+ m_DataAccess.SetAccessMode(accessModeEnum, "807667");
|
|
|
+ List<string> param = jcIpDict[ip];
|
|
|
+ for (int j = 0; j < param.Count; j++)
|
|
|
{
|
|
|
- IJHDataEntryProperty dataEntryProperty = dataEntryPropertyList[i];
|
|
|
- if (dataEntryProperty.kind == DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA)
|
|
|
+ IJHDataEntry m_DataEntry = m_DataAccess.GetDataEntry(param[j]);
|
|
|
+ IJHDataEntryPropertyList dataEntryPropertyList = m_DataEntry.propertyList;
|
|
|
+ for (int i = 0; i < dataEntryPropertyList.Count; i++)
|
|
|
{
|
|
|
- if (j == 0)
|
|
|
+ IJHDataEntryProperty dataEntryProperty = dataEntryPropertyList[i];
|
|
|
+ if (dataEntryProperty.kind == DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA)
|
|
|
{
|
|
|
- if(ip == "192.168.10.109")
|
|
|
+ if (j == 0)
|
|
|
{
|
|
|
- responseBody.actSpindle = (Convert.ToInt32(dataEntryProperty.varValue) / 1000).ToString();
|
|
|
+ if (ip == "192.168.10.109")
|
|
|
+ {
|
|
|
+ responseBody.actSpindle = (Convert.ToInt32(dataEntryProperty.varValue) / 1000).ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ responseBody.actSpindle = dataEntryProperty.varValue.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- else
|
|
|
+ else if (j == 1)
|
|
|
{
|
|
|
- responseBody.actSpindle = dataEntryProperty.varValue.ToString();
|
|
|
+ responseBody.actFeed = dataEntryProperty.varValue.ToString();
|
|
|
}
|
|
|
-
|
|
|
- }else if (j == 1)
|
|
|
- {
|
|
|
- responseBody.actFeed = dataEntryProperty.varValue.ToString();
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
- else if (fun == ActionTypeEnum.Upload.ToString())
|
|
|
- {
|
|
|
+ else if (fun == ActionTypeEnum.Upload.ToString())
|
|
|
+ {
|
|
|
|
|
|
- JHFileSystem m_FileSystem = Machine.GetInterface(DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHFILESYSTEM);
|
|
|
+ JHFileSystem m_FileSystem = Machine.GetInterface(DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHFILESYSTEM);
|
|
|
|
|
|
- JHAutomatic m_Automatic = Machine.GetInterface(DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHAUTOMATIC);
|
|
|
+ JHAutomatic m_Automatic = Machine.GetInterface(DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHAUTOMATIC);
|
|
|
|
|
|
- string sSelectedFile = Path.GetFileName(requestBody.path);
|
|
|
+ string sSelectedFile = Path.GetFileName(requestBody.path);
|
|
|
|
|
|
- string dncPath = GenPath(RemotePath, sSelectedFile);
|
|
|
- string tempDncPath = RemotePath + "\\2.h";
|
|
|
- //设置临时程序为主程序
|
|
|
- // m_Automatic.SelectProgram(iChannel, tempDncPath);
|
|
|
- try
|
|
|
- { //删除上传文件,try异常防止文件不存在
|
|
|
- //m_FileSystem.DeleteFile(dncPath);
|
|
|
- }
|
|
|
- catch (Exception edel)
|
|
|
- {
|
|
|
+ string dncPath = GenPath(RemotePath, sSelectedFile);
|
|
|
+ string tempDncPath = RemotePath + "\\2.h";
|
|
|
+ //设置临时程序为主程序
|
|
|
+ // m_Automatic.SelectProgram(iChannel, tempDncPath);
|
|
|
+ try
|
|
|
+ { //删除上传文件,try异常防止文件不存在
|
|
|
+ //m_FileSystem.DeleteFile(dncPath);
|
|
|
+ }
|
|
|
+ catch (Exception edel)
|
|
|
+ {
|
|
|
+ }
|
|
|
+ //上传
|
|
|
+ m_FileSystem.TransmitFile(requestBody.path, dncPath);
|
|
|
+ //设当前上传程序为主程序
|
|
|
+ // m_Automatic.SelectProgram(iChannel, dncPath);
|
|
|
}
|
|
|
- //上传
|
|
|
- m_FileSystem.TransmitFile(requestBody.path, dncPath);
|
|
|
- //设当前上传程序为主程序
|
|
|
- // m_Automatic.SelectProgram(iChannel, dncPath);
|
|
|
- }
|
|
|
|
|
|
- else if (fun == ActionTypeEnum.StartNcProgram.ToString())//启动程序备用
|
|
|
- {
|
|
|
+ else if (fun == ActionTypeEnum.StartNcProgram.ToString())//启动程序备用
|
|
|
+ {
|
|
|
|
|
|
- JHAutomatic m_Automatic = Machine.GetInterface(DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHAUTOMATIC);
|
|
|
+ JHAutomatic m_Automatic = Machine.GetInterface(DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHAUTOMATIC);
|
|
|
|
|
|
- //m_Automatic.SelectProgram(iChannel, GenPath(RemotePath, hdhBody.Path));
|
|
|
- //Thread.Sleep(1000);
|
|
|
- m_Automatic.StartProgram(GenPath(RemotePath, requestBody.path));
|
|
|
- }
|
|
|
- else if (fun == ActionTypeEnum.ToolList.ToString())
|
|
|
- {
|
|
|
- IJHDataEntry2 ToolLine = null;
|
|
|
- IJHDataEntry2List ToolCells = null;
|
|
|
- //IJHDataEntry2 ToolCell = null;
|
|
|
- List<ToolsInfo> toolsList = new List<ToolsInfo>();
|
|
|
- JHDataAccess dataAccess = Machine.GetInterface(HeidenhainDNCLib.DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHDATAACCESS);
|
|
|
- dataAccess.SetAccessMode(DNC_ACCESS_MODE.DNC_ACCESS_MODE_TABLEDATAACCESS, "");
|
|
|
- //string ToolColumnNamesAccessor = @"\TABLE\TOOL\T\('1'-'50')"; // see Init()
|
|
|
- string ToolColumnNamesAccessor = @"\TABLE\TOOL_P\T\('1'-'50')";
|
|
|
- IJHDataEntry2 ToolTable = dataAccess.GetDataEntry2(ToolColumnNamesAccessor, DNC_DATA_UNIT_SELECT.DNC_DATA_UNIT_SELECT_METRIC, false);
|
|
|
- IJHDataEntry2List ToolLines = ToolTable.GetChildList();
|
|
|
- int ToolLinesCount = ToolLines.Count >= 50 ? 50 : ToolLines.Count;
|
|
|
- //int ToolLinesCount = ToolLines.Count;
|
|
|
- for (int i = 0; i < ToolLinesCount; i++)
|
|
|
+ //m_Automatic.SelectProgram(iChannel, GenPath(RemotePath, hdhBody.Path));
|
|
|
+ //Thread.Sleep(1000);
|
|
|
+ m_Automatic.StartProgram(GenPath(RemotePath, requestBody.path));
|
|
|
+ }
|
|
|
+ else if (fun == ActionTypeEnum.ToolList.ToString())
|
|
|
{
|
|
|
- ToolLine = ToolLines[i];
|
|
|
- ToolCells = ToolLine.GetChildList();
|
|
|
- // get child list from server
|
|
|
- ToolsInfo toolsInfo = new ToolsInfo();
|
|
|
+ IJHDataEntry2 ToolLine = null;
|
|
|
+ IJHDataEntry2List ToolCells = null;
|
|
|
+ //IJHDataEntry2 ToolCell = null;
|
|
|
+ List<ToolsInfo> toolsList = new List<ToolsInfo>();
|
|
|
+ JHDataAccess dataAccess = Machine.GetInterface(HeidenhainDNCLib.DNC_INTERFACE_OBJECT.DNC_INTERFACE_JHDATAACCESS);
|
|
|
+ dataAccess.SetAccessMode(DNC_ACCESS_MODE.DNC_ACCESS_MODE_TABLEDATAACCESS, "");
|
|
|
+ //string ToolColumnNamesAccessor = @"\TABLE\TOOL\T\('1'-'50')"; // see Init()
|
|
|
+ string ToolColumnNamesAccessor = @"\TABLE\TOOL_P\T\('1'-'50')";
|
|
|
+ IJHDataEntry2 ToolTable = dataAccess.GetDataEntry2(ToolColumnNamesAccessor, DNC_DATA_UNIT_SELECT.DNC_DATA_UNIT_SELECT_METRIC, false);
|
|
|
+ IJHDataEntry2List ToolLines = ToolTable.GetChildList();
|
|
|
+ int ToolLinesCount = ToolLines.Count >= 50 ? 50 : ToolLines.Count;
|
|
|
+ //int ToolLinesCount = ToolLines.Count;
|
|
|
+ for (int i = 0; i < ToolLinesCount; i++)
|
|
|
+ {
|
|
|
+ ToolLine = ToolLines[i];
|
|
|
+ ToolCells = ToolLine.GetChildList();
|
|
|
+ // get child list from server
|
|
|
+ ToolsInfo toolsInfo = new ToolsInfo();
|
|
|
|
|
|
- //刀位编码
|
|
|
- int[] pCode = ToolCells[0].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA);
|
|
|
- toolsInfo.position = string.Join(".", pCode);
|
|
|
- toolsInfo.number = ToolCells[1].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA).ToString();
|
|
|
- toolsInfo.name = ToolCells[2].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA).ToString();
|
|
|
+ //刀位编码
|
|
|
+ int[] pCode = ToolCells[0].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA);
|
|
|
+ toolsInfo.position = string.Join(".", pCode);
|
|
|
+ toolsInfo.number = ToolCells[1].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA).ToString();
|
|
|
+ toolsInfo.name = ToolCells[2].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA).ToString();
|
|
|
|
|
|
|
|
|
- if (!String.IsNullOrEmpty(toolsInfo.name) && !String.IsNullOrEmpty(toolsInfo.number) && pCode.Length > 0 && pCode[1] > 0)
|
|
|
- {
|
|
|
- string ToolNumberAccessor = @"\TABLE\TOOL\T\" + toolsInfo.number.ToString();
|
|
|
- IJHDataEntry2List ToolList = dataAccess.GetDataEntry2(ToolNumberAccessor, DNC_DATA_UNIT_SELECT.DNC_DATA_UNIT_SELECT_METRIC, false).GetChildList();
|
|
|
+ if (!String.IsNullOrEmpty(toolsInfo.name) && !String.IsNullOrEmpty(toolsInfo.number) && pCode.Length > 0 && pCode[1] > 0)
|
|
|
+ {
|
|
|
+ string ToolNumberAccessor = @"\TABLE\TOOL\T\" + toolsInfo.number.ToString();
|
|
|
+ IJHDataEntry2List ToolList = dataAccess.GetDataEntry2(ToolNumberAccessor, DNC_DATA_UNIT_SELECT.DNC_DATA_UNIT_SELECT_METRIC, false).GetChildList();
|
|
|
|
|
|
- //报警期限
|
|
|
- toolsInfo.warnLife = ToolList[10].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA).ToString();
|
|
|
- //刀具寿命目标值
|
|
|
- toolsInfo.targetLife = ToolList[11].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA).ToString();
|
|
|
- //Cur_Time使用时间
|
|
|
- toolsInfo.curTime = ToolList[12].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA).ToString();
|
|
|
+ //报警期限
|
|
|
+ toolsInfo.warnLife = ToolList[10].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA).ToString();
|
|
|
+ //刀具寿命目标值
|
|
|
+ toolsInfo.targetLife = ToolList[11].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA).ToString();
|
|
|
+ //Cur_Time使用时间
|
|
|
+ toolsInfo.curTime = ToolList[12].GetPropertyValue(DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA).ToString();
|
|
|
|
|
|
- toolsList.Add(toolsInfo);
|
|
|
+ toolsList.Add(toolsInfo);
|
|
|
+ }
|
|
|
}
|
|
|
+ //获取海德汉的刀具寿命信息
|
|
|
+ responseBody.toolsInfo = toolsList;
|
|
|
}
|
|
|
- //获取海德汉的刀具寿命信息
|
|
|
- responseBody.toolsInfo = toolsList;
|
|
|
+ }
|
|
|
+ else if (Machine.GetState().ToString() != "DNC_STATE_MACHINE_IS_AVAILABLE") //机床状态不可用 断开连接
|
|
|
+ {
|
|
|
+ responseBody.msg = Machine.GetState().ToString();
|
|
|
+ responseBody.result = false;
|
|
|
+ Machine.Disconnect();
|
|
|
+ Marshal.ReleaseComObject(Machine);
|
|
|
+ Machine = null;
|
|
|
+ machineList.Remove(requestBody.machineName);
|
|
|
}
|
|
|
}
|
|
|
- else if (Machine.GetState().ToString() != "DNC_STATE_MACHINE_IS_AVAILABLE") //机床状态不可用 断开连接
|
|
|
+ catch(Exception e)
|
|
|
{
|
|
|
+ YG.Log.Instance.WriteLogAdd($"海德汉响应结果-e-->> " + e.Message);
|
|
|
responseBody.msg = Machine.GetState().ToString();
|
|
|
responseBody.result = false;
|
|
|
Machine.Disconnect();
|
|
@@ -251,6 +265,7 @@ namespace Fanuc_HttpServer.hedidenain
|
|
|
Machine = null;
|
|
|
machineList.Remove(requestBody.machineName);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|