|
@@ -19,10 +19,23 @@ namespace Fanuc_HttpServer.hedidenain
|
|
|
private int iChannel = 0;
|
|
|
private string RemotePath = "TNC:\\nc_prog\\ATUO";//ConfigurationManager.AppSettings["RemotePath"];
|
|
|
private static string ON_LINE_STATE = "在线";
|
|
|
+ private Dictionary<String, List<string>> jcIpDict = new Dictionary<String, List<string>>();
|
|
|
+
|
|
|
//连接设备列表
|
|
|
public Dictionary<string, DNC_STATE> deviceList { get; set; } = new Dictionary<string, DNC_STATE>();
|
|
|
private DNC_STATE m_ControlState;
|
|
|
public static Dictionary<string, JHMachineInProcess> machineList { get; set; } = new Dictionary<string, JHMachineInProcess>();
|
|
|
+ public HeidenhainServer()
|
|
|
+ {
|
|
|
+ List<string> ip1 = new List<string>();
|
|
|
+ ip1.Add("\\PLC\\memory\\D\\17600");
|
|
|
+ ip1.Add("\\PLC\\memory\\D\\3062");
|
|
|
+ jcIpDict.Add("192.168.10.109", ip1);
|
|
|
+ List<string> ip2 = new List<string>();
|
|
|
+ ip2.Add("\\PLC\\memory\\D\\368");
|
|
|
+ ip2.Add("\\PLC\\memory\\D\\5048");
|
|
|
+ jcIpDict.Add("192.168.10.101", ip2);
|
|
|
+ }
|
|
|
public ResponseBody requestHttpServer(RequestBody requestBody)
|
|
|
{
|
|
|
string ip = requestBody.serverUrl;
|
|
@@ -109,9 +122,35 @@ namespace Fanuc_HttpServer.hedidenain
|
|
|
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() ;
|
|
|
-
|
|
|
-
|
|
|
+ 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++)
|
|
|
+ {
|
|
|
+ IJHDataEntry m_DataEntry = m_DataAccess.GetDataEntry(param[j]);
|
|
|
+ IJHDataEntryPropertyList dataEntryPropertyList = m_DataEntry.propertyList;
|
|
|
+ for (int i = 0; i < dataEntryPropertyList.Count; i++)
|
|
|
+ {
|
|
|
+ IJHDataEntryProperty dataEntryProperty = dataEntryPropertyList[i];
|
|
|
+ if (dataEntryProperty.kind == DNC_DATAENTRY_PROPKIND.DNC_DATAENTRY_PROPKIND_DATA)
|
|
|
+ {
|
|
|
+ if (j == 0)
|
|
|
+ {
|
|
|
+ responseBody.actSpindle = dataEntryProperty.varValue.ToString();
|
|
|
+ }else if (j == 1)
|
|
|
+ {
|
|
|
+ responseBody.actFeed = dataEntryProperty.varValue.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else if (fun == ActionTypeEnum.Upload.ToString())
|
|
|
{
|
|
@@ -127,8 +166,8 @@ namespace Fanuc_HttpServer.hedidenain
|
|
|
//设置临时程序为主程序
|
|
|
// m_Automatic.SelectProgram(iChannel, tempDncPath);
|
|
|
try
|
|
|
- { //删除上传文件,try异常防止文件不存在
|
|
|
- //m_FileSystem.DeleteFile(dncPath);
|
|
|
+ { //删除上传文件,try异常防止文件不存在
|
|
|
+ //m_FileSystem.DeleteFile(dncPath);
|
|
|
}
|
|
|
catch (Exception edel)
|
|
|
{
|