|
@@ -57,6 +57,9 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
private string ecsRootUrlContext;
|
|
private string ecsRootUrlContext;
|
|
|
|
|
|
|
|
+ // 科德httpserver接口地址
|
|
|
|
+ private string kedeContext;
|
|
|
|
+
|
|
public IConfiguration Configuration { get; }
|
|
public IConfiguration Configuration { get; }
|
|
|
|
|
|
private readonly IApiRequestService _apiRequestService;
|
|
private readonly IApiRequestService _apiRequestService;
|
|
@@ -83,6 +86,7 @@ namespace IMCS.CCS.Services
|
|
ftpUserContext = Configuration.GetConnectionString("FTPUser");
|
|
ftpUserContext = Configuration.GetConnectionString("FTPUser");
|
|
ftpPwdContext = Configuration.GetConnectionString("FTPPwd");
|
|
ftpPwdContext = Configuration.GetConnectionString("FTPPwd");
|
|
ecsRootUrlContext = Configuration.GetConnectionString("ecsRootUrlContext");
|
|
ecsRootUrlContext = Configuration.GetConnectionString("ecsRootUrlContext");
|
|
|
|
+ kedeContext = Configuration.GetConnectionString("kedeContext");
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -887,8 +891,10 @@ namespace IMCS.CCS.Services
|
|
&& x.ProtocolType.Equals(ProtocalTypeEnum.FANUC.ToString())).FirstOrDefault();
|
|
&& x.ProtocolType.Equals(ProtocalTypeEnum.FANUC.ToString())).FirstOrDefault();
|
|
Device deviceHeidenhain = devices.Where(x => x.Ip.Equals(req.url)
|
|
Device deviceHeidenhain = devices.Where(x => x.Ip.Equals(req.url)
|
|
&& x.ProtocolType.Equals(ProtocalTypeEnum.HEIDEHAIN.ToString())).FirstOrDefault();
|
|
&& x.ProtocolType.Equals(ProtocalTypeEnum.HEIDEHAIN.ToString())).FirstOrDefault();
|
|
|
|
+ Device deviceKeDe = devices.Where(x => x.Ip.Equals(req.url)
|
|
|
|
+ && x.ProtocolType.Equals(ProtocalTypeEnum.KEDE.ToString())).FirstOrDefault();
|
|
|
|
|
|
- if (deviceOpcUa == null && deviceFanuc == null && deviceHeidenhain == null)
|
|
|
|
|
|
+ if (deviceOpcUa == null && deviceFanuc == null && deviceHeidenhain == null && deviceKeDe == null)
|
|
{
|
|
{
|
|
Log.Instance.WriteLogAdd(ActionTypeEnum.UploadFile + "设备已离线===>>" + JsonConvert.SerializeObject(req),
|
|
Log.Instance.WriteLogAdd(ActionTypeEnum.UploadFile + "设备已离线===>>" + JsonConvert.SerializeObject(req),
|
|
EnumHelper.GetDescription(ActionTypeEnum.UploadFile));
|
|
EnumHelper.GetDescription(ActionTypeEnum.UploadFile));
|
|
@@ -931,7 +937,8 @@ namespace IMCS.CCS.Services
|
|
return responseData;
|
|
return responseData;
|
|
}
|
|
}
|
|
|
|
|
|
- }else if(deviceHeidenhain != null)
|
|
|
|
|
|
+ }
|
|
|
|
+ else if(deviceHeidenhain != null)
|
|
{
|
|
{
|
|
//海德汉程序上传后,同时写入编号
|
|
//海德汉程序上传后,同时写入编号
|
|
if (string.IsNullOrEmpty(req.data.fileName))
|
|
if (string.IsNullOrEmpty(req.data.fileName))
|
|
@@ -1002,8 +1009,35 @@ namespace IMCS.CCS.Services
|
|
}
|
|
}
|
|
//return responseData;
|
|
//return responseData;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else if (deviceKeDe != null)
|
|
|
|
+ {
|
|
|
|
+ Console.WriteLine("==============科德机床上传程序并设置此程序为主程序=================");
|
|
|
|
+ RequestKeDeData kedeReq = new RequestKeDeData();
|
|
|
|
+ kedeReq.serverUrl = deviceKeDe.ServerUrl;
|
|
|
|
+ kedeReq.type = "2";
|
|
|
|
+ kedeReq.userName = deviceKeDe.UserName;
|
|
|
|
+ kedeReq.password = deviceKeDe.Password;
|
|
|
|
+ kedeReq.port = deviceKeDe.Port;
|
|
|
|
+ kedeReq.localFilePath = req.data.fileName;
|
|
|
|
+ kedeReq.remoteFilePath = req.data.remotePath;
|
|
|
|
+
|
|
|
|
+ Console.WriteLine("nc上传请求地址{0},参数{1}", kedeContext, kedeReq);
|
|
|
|
+
|
|
|
|
+ var Result = await _apiRequestService.RequestAsync(RequsetModeEnum.Post, kedeContext, kedeReq, null);
|
|
|
|
+ ResponseOpcUaData responseOpcUaData = JsonConvert.DeserializeObject<ResponseOpcUaData>(Result.Message);
|
|
|
|
+ if (!Result.IsSuccess || !responseOpcUaData.result)
|
|
|
|
+ {
|
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.UploadFile + "上传异常===>>" + JsonConvert.SerializeObject(req),
|
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.UploadFile));
|
|
|
|
+ responseData.result = "false";
|
|
|
|
+ return responseData;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
//插入回调
|
|
//插入回调
|