|
@@ -797,6 +797,8 @@ namespace IMCS.CCS.Services
|
|
|
/// <returns></returns>
|
|
|
public async Task<ResponseECSData> CutterDeviceTakeOrPutRequest(RequestData<CutterLocationData> req)
|
|
|
{
|
|
|
+ Log.Instance.WriteLogAdd("查询刀具上下料站、机床刀具位是否允许放===>> " + JsonConvert.SerializeObject(req), "刀具取放状态");
|
|
|
+
|
|
|
ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "执行成功");
|
|
|
SiemensS7Net s7 = null;
|
|
|
try
|
|
@@ -2023,6 +2025,15 @@ namespace IMCS.CCS.Services
|
|
|
actionQuery.Ip = req.url;
|
|
|
CcsAction actionInfo = _ccsActionService.GetList(actionQuery).FirstOrDefault();
|
|
|
|
|
|
+ if (actionInfo == null)
|
|
|
+ {
|
|
|
+ Log.Instance.WriteLogAdd("CutterPut" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req),
|
|
|
+ "刀具取放状态");
|
|
|
+ responseData.result = "true";
|
|
|
+ responseData.resultMsg = "CutterPut" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req);
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
+
|
|
|
// 进行plc的连接
|
|
|
s7 = DevicePlcS7.SiemensS7(actionInfo.Ip);
|
|
|
OperateResult ConnectionResult = s7.ConnectServer();
|
|
@@ -2173,6 +2184,35 @@ namespace IMCS.CCS.Services
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ // 根据ip查询配置的字节数据
|
|
|
+ CcsAction actionQuery = new CcsAction();
|
|
|
+ actionQuery.OperateType = "CutterPut" + req.data.location.ToString();
|
|
|
+ actionQuery.Ip = req.url;
|
|
|
+ CcsAction actionInfo = _ccsActionService.GetList(actionQuery).FirstOrDefault();
|
|
|
+
|
|
|
+ if (actionInfo == null) {
|
|
|
+ Log.Instance.WriteLogAdd("CutterPut" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req),
|
|
|
+ "刀具取放状态");
|
|
|
+ responseData.result = "true";
|
|
|
+ responseData.resultMsg = "CutterPut" + req.data.location + "异常===>>" + "没有查询到配置方法,默认通过" + JsonConvert.SerializeObject(req);
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 进行plc的连接
|
|
|
+ s7 = DevicePlcS7.SiemensS7(actionInfo.Ip);
|
|
|
+ OperateResult ConnectionResult = s7.ConnectServer();
|
|
|
+ if (!ConnectionResult.IsSuccess)
|
|
|
+ {
|
|
|
+ s7.ConnectClose();
|
|
|
+ Log.Instance.WriteLogAdd("CutterPut" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
|
|
|
+ "刀具取放状态");
|
|
|
+ responseData.result = "false";
|
|
|
+ responseData.resultMsg = "CutterPut" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
+
|
|
|
//=========================上下料站请求判断 开始======================
|
|
|
// 目标点位是上下料站的判断下料请求是否为true,上料请求为false,
|
|
|
// 如果不是判断上料请求是否为true,
|
|
@@ -2223,26 +2263,6 @@ namespace IMCS.CCS.Services
|
|
|
//=========================上下料站请求判断 结束======================
|
|
|
|
|
|
|
|
|
-
|
|
|
- // 根据ip查询配置的字节数据
|
|
|
- CcsAction actionQuery = new CcsAction();
|
|
|
- actionQuery.OperateType = "CutterPut" + req.data.location.ToString();
|
|
|
- actionQuery.Ip = req.url;
|
|
|
- CcsAction actionInfo = _ccsActionService.GetList(actionQuery).FirstOrDefault();
|
|
|
-
|
|
|
- // 进行plc的连接
|
|
|
- s7 = DevicePlcS7.SiemensS7(actionInfo.Ip);
|
|
|
- OperateResult ConnectionResult = s7.ConnectServer();
|
|
|
- if (!ConnectionResult.IsSuccess)
|
|
|
- {
|
|
|
- s7.ConnectClose();
|
|
|
- Log.Instance.WriteLogAdd("CutterPut" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
|
|
|
- "刀具取放状态");
|
|
|
- responseData.result = "false";
|
|
|
- responseData.resultMsg = "CutterPut" + req.data.location + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
|
|
|
- return responseData;
|
|
|
- }
|
|
|
-
|
|
|
// 查询需要操作的plc的db块
|
|
|
CcsActionAddress actionAddressQuery = new CcsActionAddress();
|
|
|
actionAddressQuery.ActionId = actionInfo.Id;
|