|
@@ -470,9 +470,9 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 机器人取放动作
|
|
|
+ /// 天轨机器人取放动作
|
|
|
/// </summary>
|
|
|
- public async Task<ResponseECSData> CutterRobotAction(RequestData<LocationData> req)
|
|
|
+ public async Task<ResponseECSData> CutterRobotAction(RequestData<CutterLocationData> req)
|
|
|
{
|
|
|
ResponseECSData responseData = new ResponseECSData(req.taskId, req.taskNodeId, "执行成功");
|
|
|
SiemensS7Net s7 = null;
|
|
@@ -487,8 +487,8 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
if (device == null)
|
|
|
{
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "设备已离线===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "设备已离线===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
|
|
|
responseData.result = "false";
|
|
|
responseData.resultMsg = "设备已离线:" + req.url;
|
|
|
return responseData;
|
|
@@ -506,10 +506,10 @@ namespace IMCS.CCS.Services
|
|
|
if (!ConnectionResult.IsSuccess)
|
|
|
{
|
|
|
s7.ConnectClose();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
|
|
|
responseData.result = "false";
|
|
|
- responseData.resultMsg = ActionTypeEnum.RobotAction + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
|
|
|
+ responseData.resultMsg = ActionTypeEnum.CutterRobotAction + "异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req);
|
|
|
return responseData;
|
|
|
}
|
|
|
|
|
@@ -526,8 +526,8 @@ namespace IMCS.CCS.Services
|
|
|
if (!callbackData.isSuccess)
|
|
|
{
|
|
|
s7.ConnectClose();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "====" + callbackData.msg + "====" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "====" + callbackData.msg + "====" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
|
|
|
responseData.result = "false";
|
|
|
responseData.resultMsg = callbackData.msg;
|
|
|
return responseData;
|
|
@@ -546,8 +546,8 @@ namespace IMCS.CCS.Services
|
|
|
if (!callbackData.isSuccess)
|
|
|
{
|
|
|
s7.ConnectClose();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "====" + callbackData.msg + "====" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "====" + callbackData.msg + "====" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
|
|
|
responseData.result = "false";
|
|
|
responseData.resultMsg = callbackData.msg;
|
|
|
return responseData;
|
|
@@ -570,8 +570,8 @@ namespace IMCS.CCS.Services
|
|
|
if (actionAddress.CheckType ? operateResult != actionAddress.Value : operateResult == actionAddress.Value)
|
|
|
{
|
|
|
s7.ConnectClose();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "====实际为:" + operateResult + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
|
|
|
responseData.result = "false";
|
|
|
responseData.resultMsg = "异常===>>" + "条件不满足" + actionAddress.Address + "值应为:" + actionAddress.Value + "==实际为:" + operateResult;
|
|
|
return responseData;
|
|
@@ -600,6 +600,25 @@ namespace IMCS.CCS.Services
|
|
|
parValue = actionAddress.Value;
|
|
|
s7.Write(actionAddress.Address, Convert.ToBoolean(parValue));
|
|
|
}
|
|
|
+ else if (actionAddress.Sort == 3)
|
|
|
+ {
|
|
|
+ // 写入源刀位号
|
|
|
+ parValue = req.data.LocationNo;
|
|
|
+ if (req.data.LocationNo == null || req.data.LocationNo == "") {
|
|
|
+ parValue = "0";
|
|
|
+ }
|
|
|
+ s7.Write(actionAddress.Address, Convert.ToByte(parValue));
|
|
|
+ }
|
|
|
+ else if (actionAddress.Sort == 4)
|
|
|
+ {
|
|
|
+ // 写入目的刀位号
|
|
|
+ parValue = req.data.DestLocationNo;
|
|
|
+ if (req.data.DestLocationNo == null || req.data.DestLocationNo == "")
|
|
|
+ {
|
|
|
+ parValue = "0";
|
|
|
+ }
|
|
|
+ s7.Write(actionAddress.Address, Convert.ToByte(parValue));
|
|
|
+ }
|
|
|
|
|
|
// 同步TagValue数据状态
|
|
|
CcsTagValue tagValueQuery = new CcsTagValue();
|
|
@@ -620,22 +639,22 @@ namespace IMCS.CCS.Services
|
|
|
s7.ConnectClose();
|
|
|
|
|
|
//插入回调
|
|
|
- TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.RobotAction.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.RobotAction), req.taskId, req.taskNodeId);
|
|
|
+ TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.CutterRobotAction.ToString(),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction), req.taskId, req.taskNodeId);
|
|
|
taskCallbackData = setCallBackValue(CcsActionAddresses, taskCallbackData);
|
|
|
|
|
|
// 保存数据
|
|
|
await _taskCallbackService.CreateOrUpdateAndCache(taskCallbackData);
|
|
|
- Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.RobotAction) + "取成功===>>" + JsonConvert.SerializeObject(req)
|
|
|
- , EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
|
|
|
+ Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction) + "取成功===>>" + JsonConvert.SerializeObject(req)
|
|
|
+ , EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
|
|
|
return responseData;
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
// 记录日志
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "取放异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
|
|
|
- responseData.resultMsg = ActionTypeEnum.RobotAction + "取放异常===>>" + ex.Message + JsonConvert.SerializeObject(req);
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.CutterRobotAction + "取放异常===>>" + ex.Message + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.CutterRobotAction));
|
|
|
+ responseData.resultMsg = ActionTypeEnum.CutterRobotAction + "取放异常===>>" + ex.Message + JsonConvert.SerializeObject(req);
|
|
|
responseData.result = "false";
|
|
|
|
|
|
// 关闭plc连接
|