|
@@ -209,6 +209,7 @@ namespace IMCS.CCS.Services
|
|
|
}
|
|
|
}
|
|
|
List<CcsActionAddress> CcsActionAddressWriteChecks = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.WRITE_CHECK.ToString()).ToList();
|
|
|
+ bool checkFlag = true;
|
|
|
foreach (CcsActionAddress actionAddress in CcsActionAddressWriteChecks)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(actionAddress.Address) && !string.IsNullOrEmpty(actionAddress.Value))
|
|
@@ -216,13 +217,25 @@ namespace IMCS.CCS.Services
|
|
|
string operateResult = s7.ReadInt16(actionAddress.Address).Content.ToString();
|
|
|
if (operateResult != actionAddress.Value)
|
|
|
{
|
|
|
- s7.ConnectClose();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "异常===>>" + "写入失败" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ //取参数传参值
|
|
|
+ string dataValue = getProperties(req.data, actionAddress.Description);
|
|
|
+ //读取写入结果
|
|
|
+ string readWriteResult = s7.ReadInt16(actionAddress.Address).Content.ToString();
|
|
|
+ if(dataValue != readWriteResult)
|
|
|
+ {
|
|
|
+ s7.ConnectClose();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.RobotAction + "异常===>>" + "写入失败,plc没有写入相应的值" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.RobotAction));
|
|
|
+ responseData.result = "false";
|
|
|
+ checkFlag = false;
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ if (!checkFlag)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
//二次写入地址列表
|
|
|
List<CcsActionAddress> CcsActionAddressWriteSeconds = CcsActionAddresses.Where(o => o.Type == ActionAddressTypeEnum.WRITE_SECOND.ToString()).ToList();
|