|
@@ -71,7 +71,7 @@ namespace IMCS.CCS.Services
|
|
|
digitalTwinsData.deviceType = equipment.Type;
|
|
|
digitalTwinsData.deviceName = equipment.Name;
|
|
|
digitalTwinsData.monitoringStatus = equipment.Status;
|
|
|
- digitalTwinsData.operationName = "工序名称";
|
|
|
+ digitalTwinsData.operationName = "工序名称";
|
|
|
digitalTwinsData.orderName = "100001";
|
|
|
digitalTwinsData.orderNumber = "100002";
|
|
|
digitalTwinsData.productName = "100003";
|
|
@@ -123,35 +123,43 @@ namespace IMCS.CCS.Services
|
|
|
Plc s7 = DevicePlcS7.S7(req.url, ProtocalTypeEnum.S7_1500.ToString());
|
|
|
if (s7.IsConnected != true)
|
|
|
{
|
|
|
- s7.Close();
|
|
|
Log.Instance.WriteLogAdd(ActionTypeEnum.GetIntelligenceUnit + "取物品异常===>>" + "PLC连接不上" + JsonConvert.SerializeObject(req),
|
|
|
EnumHelper.GetDescription(ActionTypeEnum.GetIntelligenceUnit));
|
|
|
responseData.result = "false";
|
|
|
return responseData;
|
|
|
}
|
|
|
|
|
|
- string Address3 = ToolUtils.AddressConvertDBW(actionInfo.Address3);
|
|
|
- var operateResult = ((ushort)s7.Read(Address3)).ConvertToShort();
|
|
|
- if (operateResult.ToString() != actionInfo.CheckValue)
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress) && !string.IsNullOrEmpty(actionInfo.CheckValue))
|
|
|
{
|
|
|
- s7.Close();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.GetIntelligenceUnit + "取物品异常===>>" + "条件不满足" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetIntelligenceUnit));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ string CheckAddress = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress)).ConvertToShort();
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString().Equals(actionInfo.CheckValue) : operateResult.ToString() != actionInfo.CheckValue)
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.GetIntelligenceUnit + "取物品异常===>>" + "条件不满足" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetIntelligenceUnit));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
|
- s7.Write(Address1, Convert.ToInt16(req.data.Location));
|
|
|
- Thread.Sleep(SLEEP_TIME);
|
|
|
-
|
|
|
- string Address2 = ToolUtils.AddressConvertDBW(actionInfo.Address2);
|
|
|
- s7.Write(Address2, Convert.ToInt16(actionInfo.MoveIndex));
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.Address))
|
|
|
+ {
|
|
|
+ string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
|
+ s7.Write(Address1, Convert.ToInt16(req.data.Location));
|
|
|
+ Thread.Sleep(SLEEP_TIME);
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.Address2))
|
|
|
+ {
|
|
|
+ string Address2 = ToolUtils.AddressConvertDBW(actionInfo.Address2);
|
|
|
+ s7.Write(Address2, Convert.ToInt16(actionInfo.MoveIndex));
|
|
|
+ }
|
|
|
s7.Close();
|
|
|
|
|
|
+
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.GetIntelligenceUnit.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetIntelligenceUnit), req.taskId, req.taskNodeId, actionInfo.Address2, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetIntelligenceUnit), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, actionInfo.CallbackValue);
|
|
|
taskCallbackData.CallbackValue2 = actionInfo.CallbackValue2;
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
|
Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.GetIntelligenceUnit) + "取物品成功===>>" + JsonConvert.SerializeObject(req)
|
|
@@ -203,41 +211,54 @@ namespace IMCS.CCS.Services
|
|
|
return responseData;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- string Address3 = ToolUtils.AddressConvertDBW(actionInfo.Address3);
|
|
|
- var operateResult = ((ushort)s7.Read(Address3)).ConvertToShort();
|
|
|
- if ((operateResult.ToString() != actionInfo.CheckValue) && (operateResult.ToString() != actionInfo.CheckValue2) && (operateResult.ToString() != actionInfo.CheckValue3))
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress))
|
|
|
{
|
|
|
- s7.Close();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.GetFlexibleWire + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetFlexibleWire));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ string CheckAddress = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress)).ConvertToShort();
|
|
|
+ bool CheckFlag = string.IsNullOrEmpty(actionInfo.CheckValue) ? false : (actionInfo.CheckType ? (operateResult.ToString() == actionInfo.CheckValue) : (operateResult.ToString() != actionInfo.CheckValue));
|
|
|
+ bool CheckFlag2 = string.IsNullOrEmpty(actionInfo.CheckValue2) ? true : (actionInfo.CheckType2 ? (operateResult.ToString() == actionInfo.CheckValue2) : (operateResult.ToString() != actionInfo.CheckValue2));
|
|
|
+ bool CheckFlag3 = string.IsNullOrEmpty(actionInfo.CheckValue3) ? true : (actionInfo.CheckType3 ? (operateResult.ToString() == actionInfo.CheckValue3) : (operateResult.ToString() != actionInfo.CheckValue3));
|
|
|
+ if (CheckFlag && CheckFlag2 && CheckFlag3)
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.GetFlexibleWire + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetFlexibleWire));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- short MyPlcData;
|
|
|
- string Address5 = ToolUtils.AddressConvertDBW(actionInfo.Address5);
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress4))
|
|
|
+ {
|
|
|
+ string CheckAddress4 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress4);
|
|
|
|
|
|
- MyPlcData = ((ushort)s7.Read(Address5)).ConvertToShort();
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress4)).ConvertToShort();
|
|
|
|
|
|
- if (MyPlcData == 3)
|
|
|
- {
|
|
|
- responseData.result = "false";
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.GetFlexibleWire + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetFlexibleWire));
|
|
|
- s7.Close();
|
|
|
- return responseData;
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString() == actionInfo.CheckValue4 : operateResult.ToString() != actionInfo.CheckValue4)
|
|
|
+ {
|
|
|
+ responseData.result = "false";
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.GetFlexibleWire + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetFlexibleWire));
|
|
|
+ s7.Close();
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- string Address6 = ToolUtils.AddressConvertDBW(actionInfo.Address6);
|
|
|
- MyPlcData = ((ushort)s7.Read(Address6)).ConvertToShort();
|
|
|
- if (MyPlcData != 1)
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress5))
|
|
|
{
|
|
|
- responseData.result = "false";
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.GetFlexibleWire + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetFlexibleWire));
|
|
|
- s7.Close();
|
|
|
- return responseData;
|
|
|
+ string CheckAddress5 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress5);
|
|
|
+
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress5)).ConvertToShort();
|
|
|
+
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString() == actionInfo.CheckValue5 : operateResult.ToString() != actionInfo.CheckValue5)
|
|
|
+ {
|
|
|
+ responseData.result = "false";
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.GetFlexibleWire + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetFlexibleWire));
|
|
|
+ s7.Close();
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
@@ -250,9 +271,9 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.GetFlexibleWire.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetFlexibleWire), req.taskId, req.taskNodeId, actionInfo.Address4, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetFlexibleWire), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, actionInfo.CallbackValue);
|
|
|
|
|
|
- taskCallbackData.Address3 = Address5;
|
|
|
+ taskCallbackData.Address3 = actionInfo.Address5;
|
|
|
taskCallbackData.CallbackValue2 = actionInfo.CallbackValue2;
|
|
|
taskCallbackData.CallbackValue3 = actionInfo.CallbackValue3;
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
@@ -305,15 +326,18 @@ namespace IMCS.CCS.Services
|
|
|
return responseData;
|
|
|
}
|
|
|
|
|
|
- string Address3 = ToolUtils.AddressConvertDBW(actionInfo.Address3);
|
|
|
- var operateResult = ((ushort)s7.Read(Address3)).ConvertToShort();
|
|
|
- if (operateResult.ToString() != actionInfo.CheckValue)
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress) && !string.IsNullOrEmpty(actionInfo.CheckValue))
|
|
|
{
|
|
|
- s7.Close();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.GetQualityCenter + "取物品异常===>>" + "条件不满足" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetQualityCenter));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ string CheckAddress = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress)).ConvertToShort();
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString().Equals(actionInfo.CheckValue) : operateResult.ToString() != actionInfo.CheckValue)
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.GetQualityCenter + "取物品异常===>>" + "条件不满足" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetQualityCenter));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
@@ -326,7 +350,7 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.GetQualityCenter.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetQualityCenter), req.taskId, req.taskNodeId, actionInfo.Address2, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetQualityCenter), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, actionInfo.CallbackValue);
|
|
|
taskCallbackData.CallbackValue2 = actionInfo.CallbackValue2;
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
|
Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.GetQualityCenter) + "取物品成功===>>" + JsonConvert.SerializeObject(req)
|
|
@@ -379,15 +403,18 @@ namespace IMCS.CCS.Services
|
|
|
}
|
|
|
|
|
|
//条件判断
|
|
|
- string Address3 = ToolUtils.AddressConvertDBW(actionInfo.Address3);
|
|
|
- var operateResult = ((ushort)s7.Read(Address3)).ConvertToShort();
|
|
|
- if (operateResult.ToString() != actionInfo.CheckValue)
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress) && !string.IsNullOrEmpty(actionInfo.CheckValue))
|
|
|
{
|
|
|
- s7.Close();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.SendIntelligenceUnit + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendIntelligenceUnit));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ string CheckAddress = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress)).ConvertToShort();
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString().Equals(actionInfo.CheckValue) : operateResult.ToString() != actionInfo.CheckValue)
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.SendIntelligenceUnit + "放物品异常===>>" + "条件不满足" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendIntelligenceUnit));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
@@ -400,7 +427,7 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.SendIntelligenceUnit.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendIntelligenceUnit), req.taskId, req.taskNodeId, actionInfo.Address2, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendIntelligenceUnit), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, actionInfo.CallbackValue);
|
|
|
taskCallbackData.CallbackValue2 = actionInfo.CallbackValue2;
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
|
Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.SendIntelligenceUnit) + "放物品成功===>>" + JsonConvert.SerializeObject(req)
|
|
@@ -451,42 +478,55 @@ namespace IMCS.CCS.Services
|
|
|
responseData.result = "false";
|
|
|
return responseData;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- string Address3 = ToolUtils.AddressConvertDBW(actionInfo.Address3);
|
|
|
- var operateResult = ((ushort)s7.Read(Address3)).ConvertToShort();
|
|
|
- if ((operateResult.ToString() != actionInfo.CheckValue) && (operateResult.ToString() != actionInfo.CheckValue2) && (operateResult.ToString() != actionInfo.CheckValue3))
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress))
|
|
|
{
|
|
|
- s7.Close();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.SendFlexibleWire + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendFlexibleWire));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ string CheckAddress = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress)).ConvertToShort();
|
|
|
+ bool CheckFlag = string.IsNullOrEmpty(actionInfo.CheckValue) ? false : (actionInfo.CheckType ? (operateResult.ToString() == actionInfo.CheckValue) : (operateResult.ToString() != actionInfo.CheckValue));
|
|
|
+ bool CheckFlag2 = string.IsNullOrEmpty(actionInfo.CheckValue2) ? true : (actionInfo.CheckType2 ? (operateResult.ToString() == actionInfo.CheckValue2) : (operateResult.ToString() != actionInfo.CheckValue2));
|
|
|
+ bool CheckFlag3 = string.IsNullOrEmpty(actionInfo.CheckValue3) ? true : (actionInfo.CheckType3 ? (operateResult.ToString() == actionInfo.CheckValue3) : (operateResult.ToString() != actionInfo.CheckValue3));
|
|
|
+ if (CheckFlag && CheckFlag2 && CheckFlag3)
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.SendFlexibleWire + "放物品异常===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendFlexibleWire));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- short MyPlcData;
|
|
|
- string Address5 = ToolUtils.AddressConvertDBW(actionInfo.Address5);
|
|
|
-
|
|
|
- MyPlcData = ((ushort)s7.Read(Address5)).ConvertToShort();
|
|
|
|
|
|
- if (MyPlcData == 3)
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress4))
|
|
|
{
|
|
|
- responseData.result = "false";
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.SendFlexibleWire + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendFlexibleWire));
|
|
|
- s7.Close();
|
|
|
- return responseData;
|
|
|
+ string CheckAddress4 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress4);
|
|
|
+
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress4)).ConvertToShort();
|
|
|
+
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString() == actionInfo.CheckValue4 : operateResult.ToString() != actionInfo.CheckValue4)
|
|
|
+ {
|
|
|
+ responseData.result = "false";
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.SendFlexibleWire + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendFlexibleWire));
|
|
|
+ s7.Close();
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- string Address6 = ToolUtils.AddressConvertDBW(actionInfo.Address6);
|
|
|
- MyPlcData = ((ushort)s7.Read(Address6)).ConvertToShort();
|
|
|
- if (MyPlcData != 1)
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress5))
|
|
|
{
|
|
|
- responseData.result = "false";
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.SendFlexibleWire + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendFlexibleWire));
|
|
|
- s7.Close();
|
|
|
- return responseData;
|
|
|
+ string CheckAddress5 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress5);
|
|
|
+
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress5)).ConvertToShort();
|
|
|
+
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString() == actionInfo.CheckValue5 : operateResult.ToString() != actionInfo.CheckValue5)
|
|
|
+ {
|
|
|
+ responseData.result = "false";
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.SendFlexibleWire + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendFlexibleWire));
|
|
|
+ s7.Close();
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
@@ -499,9 +539,9 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.SendFlexibleWire.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendFlexibleWire), req.taskId, req.taskNodeId, actionInfo.Address2, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendFlexibleWire), req.taskId, req.taskNodeId, actionInfo.Address, actionInfo.CallbackValue);
|
|
|
|
|
|
- taskCallbackData.Address3 = Address5;
|
|
|
+ taskCallbackData.Address3 = actionInfo.CallbackAddress3;
|
|
|
taskCallbackData.CallbackValue2 = actionInfo.CallbackValue2;
|
|
|
taskCallbackData.CallbackValue3 = actionInfo.CallbackValue3;
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
@@ -555,15 +595,18 @@ namespace IMCS.CCS.Services
|
|
|
}
|
|
|
|
|
|
//条件判断
|
|
|
- string Address3 = ToolUtils.AddressConvertDBW(actionInfo.Address3);
|
|
|
- var operateResult = ((ushort)s7.Read(Address3)).ConvertToShort();
|
|
|
- if (operateResult.ToString() != actionInfo.CheckValue)
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress))
|
|
|
{
|
|
|
- s7.Close();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.SendQualityCenter + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendQualityCenter));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ string CheckAddress = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress)).ConvertToShort();
|
|
|
+ if (actionInfo.CheckType ? (operateResult.ToString() == actionInfo.CheckValue) : (operateResult.ToString() != actionInfo.CheckValue))
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.SendQualityCenter + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendQualityCenter));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
@@ -576,7 +619,7 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.SendQualityCenter.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendQualityCenter), req.taskId, req.taskNodeId, actionInfo.Address2, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendQualityCenter), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, actionInfo.CallbackValue);
|
|
|
taskCallbackData.CallbackValue2 = actionInfo.CallbackValue2;
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
|
Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.SendQualityCenter) + "放物品成功===>>" + JsonConvert.SerializeObject(req)
|
|
@@ -628,41 +671,54 @@ namespace IMCS.CCS.Services
|
|
|
return responseData;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- string Address3 = ToolUtils.AddressConvertDBW(actionInfo.Address3);
|
|
|
- var operateResult = ((ushort)s7.Read(Address3)).ConvertToShort();
|
|
|
- if ((operateResult.ToString() != actionInfo.CheckValue) && (operateResult.ToString() != actionInfo.CheckValue2) && (operateResult.ToString() != actionInfo.CheckValue3))
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress))
|
|
|
{
|
|
|
- s7.Close();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.MoveRobotPosition + "移动物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.MoveRobotPosition));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ string CheckAddress = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress)).ConvertToShort();
|
|
|
+ bool CheckFlag = string.IsNullOrEmpty(actionInfo.CheckValue) ? false : (actionInfo.CheckType ? (operateResult.ToString() == actionInfo.CheckValue) : (operateResult.ToString() != actionInfo.CheckValue));
|
|
|
+ bool CheckFlag2 = string.IsNullOrEmpty(actionInfo.CheckValue2) ? true : (actionInfo.CheckType2 ? (operateResult.ToString() == actionInfo.CheckValue2) : (operateResult.ToString() != actionInfo.CheckValue2));
|
|
|
+ bool CheckFlag3 = string.IsNullOrEmpty(actionInfo.CheckValue3) ? true : (actionInfo.CheckType3 ? (operateResult.ToString() == actionInfo.CheckValue3) : (operateResult.ToString() != actionInfo.CheckValue3));
|
|
|
+ if (CheckFlag && CheckFlag2 && CheckFlag3)
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.MoveRobotPosition + "移动物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.MoveRobotPosition));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- short MyPlcData;
|
|
|
- string Address5 = ToolUtils.AddressConvertDBW(actionInfo.Address5);
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress4))
|
|
|
+ {
|
|
|
+ string CheckAddress4 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress4);
|
|
|
|
|
|
- MyPlcData = ((ushort)s7.Read(Address5)).ConvertToShort();
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress4)).ConvertToShort();
|
|
|
|
|
|
- if (MyPlcData == 3)
|
|
|
- {
|
|
|
- responseData.result = "false";
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.MoveRobotPosition + "移动物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.MoveRobotPosition));
|
|
|
- s7.Close();
|
|
|
- return responseData;
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString() == actionInfo.CheckValue4 : operateResult.ToString() != actionInfo.CheckValue4)
|
|
|
+ {
|
|
|
+ responseData.result = "false";
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.MoveRobotPosition + "移动物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.MoveRobotPosition));
|
|
|
+ s7.Close();
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- string Address6 = ToolUtils.AddressConvertDBW(actionInfo.Address6);
|
|
|
- MyPlcData = ((ushort)s7.Read(Address6)).ConvertToShort();
|
|
|
- if (MyPlcData != 1)
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress5))
|
|
|
{
|
|
|
- responseData.result = "false";
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.MoveRobotPosition + "移动物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.MoveRobotPosition));
|
|
|
- s7.Close();
|
|
|
- return responseData;
|
|
|
+ string CheckAddress5 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress5);
|
|
|
+
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress5)).ConvertToShort();
|
|
|
+
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString() == actionInfo.CheckValue5 : operateResult.ToString() != actionInfo.CheckValue5)
|
|
|
+ {
|
|
|
+ responseData.result = "false";
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.MoveRobotPosition + "移动物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.MoveRobotPosition));
|
|
|
+ s7.Close();
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
@@ -675,9 +731,9 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.MoveRobotPosition.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.MoveRobotPosition), req.taskId, req.taskNodeId, actionInfo.Address4, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.MoveRobotPosition), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, actionInfo.CallbackValue);
|
|
|
|
|
|
- taskCallbackData.Address3 = Address5;
|
|
|
+ taskCallbackData.Address3 = actionInfo.Address3;
|
|
|
taskCallbackData.CallbackValue2 = actionInfo.CallbackValue2;
|
|
|
taskCallbackData.CallbackValue3 = actionInfo.CallbackValue3;
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
@@ -704,7 +760,7 @@ namespace IMCS.CCS.Services
|
|
|
{
|
|
|
List<Device> devices = _deviceService.GetDeviceAllList();
|
|
|
|
|
|
- Device device = devices.Where(x => x.Ip.Equals(req.url) && x.Port.Equals(req.port)
|
|
|
+ Device device = devices.Where(x => x.Ip.Equals(req.url) && x.Port.Equals(req.port)
|
|
|
&& x.ProtocolType.Equals(ProtocalTypeEnum.FTP.ToString())).FirstOrDefault();
|
|
|
|
|
|
if (device == null)
|
|
@@ -715,18 +771,18 @@ namespace IMCS.CCS.Services
|
|
|
return responseData;
|
|
|
}
|
|
|
|
|
|
- CcsAction actionQuery = new CcsAction();
|
|
|
+ /*CcsAction actionQuery = new CcsAction();
|
|
|
actionQuery.OperateType = ActionTypeEnum.UploadFile.ToString();
|
|
|
actionQuery.Ip = req.url;
|
|
|
List<CcsAction> actions = _ccsActionService.GetList(actionQuery);
|
|
|
- CcsAction actionInfo = actions[0];
|
|
|
-
|
|
|
+ CcsAction actionInfo = actions[0]; */
|
|
|
+
|
|
|
new DeviceFtp().GetFile(req.data.fileName, LocalPath);
|
|
|
|
|
|
/* DeviceWinSCP winScp = new DeviceWinSCP(device.UserName, device.Password, device.Ip);
|
|
|
winScp.PutFile(req.data.fileName, LocalPath, req.data.remotePath);*/
|
|
|
|
|
|
- DeviceSFTP sftp = new DeviceSFTP(device.UserName,device.Port, device.Password, device.Ip);
|
|
|
+ DeviceSFTP sftp = new DeviceSFTP(device.UserName, device.Port, device.Password, device.Ip);
|
|
|
if (sftp.Connect())
|
|
|
{
|
|
|
sftp.Put(LocalPath + req.data.fileName, req.data.remotePath);
|
|
@@ -734,7 +790,10 @@ namespace IMCS.CCS.Services
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.UploadFile + "上传异常,scp连接失败," + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.UploadFile));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
}
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.UploadFile.ToString(),
|
|
@@ -778,7 +837,6 @@ namespace IMCS.CCS.Services
|
|
|
List<CcsAction> actions = _ccsActionService.GetList(actionQuery);
|
|
|
CcsAction actionInfo = actions[0];
|
|
|
|
|
|
-
|
|
|
DeviceOPCUat opcUa = new DeviceOPCUat(device.ServerUrl, device.UserName, device.Password);
|
|
|
if (opcUa.IsConnection)
|
|
|
{
|
|
@@ -790,7 +848,7 @@ namespace IMCS.CCS.Services
|
|
|
opcUa.disConnect();
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.StartNCProgram.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.StartNCProgram), req.taskId, req.taskNodeId, actionInfo.Address2, actionInfo.CallbackValue2);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.StartNCProgram), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, null);
|
|
|
Log.Instance.WriteLogAdd(ActionTypeEnum.StartNCProgram + "启动成功===>>" + JsonConvert.SerializeObject(req),
|
|
|
EnumHelper.GetDescription(ActionTypeEnum.StartNCProgram));
|
|
|
return responseData;
|
|
@@ -1026,7 +1084,7 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.StartCleanMachine.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine), req.taskId, req.taskNodeId, actionInfo.Address3, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, actionInfo.CallbackValue);
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
|
Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine) + "启动成功===>>" + JsonConvert.SerializeObject(req)
|
|
|
, EnumHelper.GetDescription(ActionTypeEnum.StartCleanMachine));
|
|
@@ -1087,26 +1145,42 @@ namespace IMCS.CCS.Services
|
|
|
}
|
|
|
string[] sArray;
|
|
|
|
|
|
- sArray = actionInfo.Address5.Split('.');
|
|
|
- s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(TypeNo, 1));
|
|
|
-
|
|
|
- sArray = actionInfo.Address6.Split('.');
|
|
|
- s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(SmallTypeNo, 1));
|
|
|
-
|
|
|
- sArray = actionInfo.Address7.Split('.');
|
|
|
- s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(OrderNo, 128));
|
|
|
-
|
|
|
- sArray = actionInfo.Address8.Split('.');
|
|
|
- s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(TaskNo, 128));
|
|
|
-
|
|
|
- sArray = actionInfo.Address9.Split('.');
|
|
|
- s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(ProductNo, 128));
|
|
|
-
|
|
|
- sArray = actionInfo.Address10.Split('.');
|
|
|
- s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(BatchNo, 32));
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.Address5) && !string.IsNullOrEmpty(TypeNo))
|
|
|
+ {
|
|
|
+ sArray = actionInfo.Address5.Split('.');
|
|
|
+ s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(TypeNo, 1));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.Address6) && !string.IsNullOrEmpty(SmallTypeNo))
|
|
|
+ {
|
|
|
+ sArray = actionInfo.Address6.Split('.');
|
|
|
+ s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(SmallTypeNo, 1));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.Address7) && !string.IsNullOrEmpty(SmallTypeNo))
|
|
|
+ {
|
|
|
+ sArray = actionInfo.Address7.Split('.');
|
|
|
+ s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(OrderNo, 128));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.Address8) && !string.IsNullOrEmpty(TaskNo))
|
|
|
+ {
|
|
|
+ sArray = actionInfo.Address8.Split('.');
|
|
|
+ s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(TaskNo, 128));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.Address9) && !string.IsNullOrEmpty(ProductNo))
|
|
|
+ {
|
|
|
+ sArray = actionInfo.Address9.Split('.');
|
|
|
+ s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(ProductNo, 128));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.Address10) && !string.IsNullOrEmpty(BatchNo))
|
|
|
+ {
|
|
|
+ sArray = actionInfo.Address10.Split('.');
|
|
|
+ s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(BatchNo, 32));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.Address11) && !string.IsNullOrEmpty(SerialNo))
|
|
|
+ {
|
|
|
+ sArray = actionInfo.Address11.Split('.');
|
|
|
+ s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(SerialNo, 6));
|
|
|
+ }
|
|
|
|
|
|
- sArray = actionInfo.Address11.Split('.');
|
|
|
- s7.WriteBytes(DataType.DataBlock, Convert.ToInt16(sArray[0].Substring(2)), Convert.ToInt16(sArray[1]) + 2, ToolUtils.ReturnBtyesWtitString(SerialNo, 6));
|
|
|
|
|
|
short mc = 0;
|
|
|
s7.Write(ToolUtils.AddressConvertDBW(actionInfo.Address), mc);
|
|
@@ -1118,9 +1192,9 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.StartLabelMachine.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.StartLabelMachine), req.taskId, req.taskNodeId, actionInfo.Address4, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.StartLabelMachine), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, actionInfo.CallbackValue);
|
|
|
+ taskCallbackData.Address3 = actionInfo.CallbackAddress3;
|
|
|
taskCallbackData.CallbackValue2 = actionInfo.CallbackValue2;
|
|
|
- taskCallbackData.Address3 = actionInfo.Address3;
|
|
|
taskCallbackData.CallbackValue3 = actionInfo.CallbackValue3;
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
|
Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.StartLabelMachine) + "启动打标机成功===>>" + JsonConvert.SerializeObject(req)
|
|
@@ -1172,16 +1246,19 @@ namespace IMCS.CCS.Services
|
|
|
return responseData;
|
|
|
}
|
|
|
|
|
|
- //条件判断
|
|
|
- string Address4 = ToolUtils.AddressConvertDBW(actionInfo.Address4);
|
|
|
- var operateResult = ((ushort)s7.Read(Address4)).ConvertToShort();
|
|
|
- if (operateResult.ToString() != actionInfo.CheckValue)
|
|
|
+ //条件判断
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress))
|
|
|
{
|
|
|
- s7.Close();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.SendQualityCenter + "启动三坐标未就绪===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendQualityCenter));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ string CheckAddress = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress)).ConvertToShort();
|
|
|
+ if (actionInfo.CheckType ? (operateResult.ToString() == actionInfo.CheckValue) : (operateResult.ToString() != actionInfo.CheckValue))
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.StartCoordinateMeasuringMachine + "启动三坐标未就绪===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.StartCoordinateMeasuringMachine));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
@@ -1206,7 +1283,7 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.StartCoordinateMeasuringMachine.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.StartCoordinateMeasuringMachine), req.taskId, req.taskNodeId, actionInfo.Address5, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.StartCoordinateMeasuringMachine), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, actionInfo.CallbackValue);
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
|
Log.Instance.WriteLogAdd(EnumHelper.GetDescription(ActionTypeEnum.StartCoordinateMeasuringMachine) + "启动三坐标成功===>>" + JsonConvert.SerializeObject(req)
|
|
|
, EnumHelper.GetDescription(ActionTypeEnum.StartCoordinateMeasuringMachine));
|
|
@@ -1257,39 +1334,55 @@ namespace IMCS.CCS.Services
|
|
|
return responseData;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- string Address3 = ToolUtils.AddressConvertDBW(actionInfo.Address3);
|
|
|
- var operateResult = ((ushort)s7.Read(Address3)).ConvertToShort();
|
|
|
- if ((operateResult.ToString() != actionInfo.CheckValue) && (operateResult.ToString() != actionInfo.CheckValue2))
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress))
|
|
|
{
|
|
|
- s7.Close();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.GetServoStacker + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetServoStacker));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ string CheckAddress = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress)).ConvertToShort();
|
|
|
+ bool CheckFlag = string.IsNullOrEmpty(actionInfo.CheckValue) ? false : (actionInfo.CheckType ? (operateResult.ToString() == actionInfo.CheckValue) : (operateResult.ToString() != actionInfo.CheckValue));
|
|
|
+ bool CheckFlag2 = string.IsNullOrEmpty(actionInfo.CheckValue2) ? true : (actionInfo.CheckType2 ? (operateResult.ToString() == actionInfo.CheckValue2) : (operateResult.ToString() != actionInfo.CheckValue2));
|
|
|
+ bool CheckFlag3 = string.IsNullOrEmpty(actionInfo.CheckValue3) ? true : (actionInfo.CheckType3 ? (operateResult.ToString() == actionInfo.CheckValue3) : (operateResult.ToString() != actionInfo.CheckValue3));
|
|
|
+ if (CheckFlag && CheckFlag2 && CheckFlag3)
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.GetServoStacker + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetServoStacker));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- short MyPlcData;
|
|
|
- string Address5 = ToolUtils.AddressConvertDBW(actionInfo.Address5);
|
|
|
- MyPlcData = ((ushort)s7.Read(Address5)).ConvertToShort();
|
|
|
- if (MyPlcData == 3)
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress4))
|
|
|
{
|
|
|
- responseData.result = "false";
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.GetServoStacker + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetServoStacker));
|
|
|
- s7.Close();
|
|
|
- return responseData;
|
|
|
+ string CheckAddress4 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress4);
|
|
|
+
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress4)).ConvertToShort();
|
|
|
+
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString() == actionInfo.CheckValue4 : operateResult.ToString() != actionInfo.CheckValue4)
|
|
|
+ {
|
|
|
+ responseData.result = "false";
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.GetServoStacker + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetServoStacker));
|
|
|
+ s7.Close();
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- string Address6 = ToolUtils.AddressConvertDBW(actionInfo.Address6);
|
|
|
- MyPlcData = ((ushort)s7.Read(Address6)).ConvertToShort();
|
|
|
- if (MyPlcData != 1)
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress5))
|
|
|
{
|
|
|
- responseData.result = "false";
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.GetServoStacker + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetServoStacker));
|
|
|
- s7.Close();
|
|
|
- return responseData;
|
|
|
+ string CheckAddress5 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress5);
|
|
|
+
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress5)).ConvertToShort();
|
|
|
+
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString() == actionInfo.CheckValue5 : operateResult.ToString() != actionInfo.CheckValue5)
|
|
|
+ {
|
|
|
+ responseData.result = "false";
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.GetServoStacker + "取物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetServoStacker));
|
|
|
+ s7.Close();
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
@@ -1302,9 +1395,9 @@ namespace IMCS.CCS.Services
|
|
|
|
|
|
//插入回调
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.GetServoStacker.ToString(),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.GetServoStacker), req.taskId, req.taskNodeId, actionInfo.Address2, actionInfo.CallbackValue);
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.GetServoStacker), req.taskId, req.taskNodeId, actionInfo.CallbackAddress, actionInfo.CallbackValue);
|
|
|
|
|
|
- taskCallbackData.Address3 = Address5;
|
|
|
+ taskCallbackData.Address3 = actionInfo.Address3;
|
|
|
taskCallbackData.CallbackValue2 = actionInfo.CallbackValue2;
|
|
|
taskCallbackData.CallbackValue3 = actionInfo.CallbackValue3;
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
@@ -1358,38 +1451,80 @@ namespace IMCS.CCS.Services
|
|
|
}
|
|
|
|
|
|
|
|
|
- string Address3 = ToolUtils.AddressConvertDBW(actionInfo.Address3);
|
|
|
- var operateResult = ((ushort)s7.Read(Address3)).ConvertToShort();
|
|
|
- if ((operateResult.ToString() != actionInfo.CheckValue) && (operateResult.ToString() != actionInfo.CheckValue2))
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress))
|
|
|
{
|
|
|
- s7.Close();
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.SendServoStacker + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendServoStacker));
|
|
|
- responseData.result = "false";
|
|
|
- return responseData;
|
|
|
+ string CheckAddress = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress)).ConvertToShort();
|
|
|
+ if (actionInfo.CheckType ? (operateResult.ToString() == actionInfo.CheckValue) : (operateResult.ToString() != actionInfo.CheckValue))
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.SendServoStacker + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendServoStacker));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- short MyPlcData;
|
|
|
- string Address5 = ToolUtils.AddressConvertDBW(actionInfo.Address5);
|
|
|
- MyPlcData = ((ushort)s7.Read(Address5)).ConvertToShort();
|
|
|
- if (MyPlcData == 3)
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress2))
|
|
|
{
|
|
|
- responseData.result = "false";
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.SendServoStacker + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendServoStacker));
|
|
|
- s7.Close();
|
|
|
- return responseData;
|
|
|
+ string CheckAddress2 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress2);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress2)).ConvertToShort();
|
|
|
+ if (actionInfo.CheckType2 ? operateResult.ToString() == actionInfo.CheckValue2 : operateResult.ToString() != actionInfo.CheckValue2)
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.SendServoStacker + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendServoStacker));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- string Address6 = ToolUtils.AddressConvertDBW(actionInfo.Address6);
|
|
|
- MyPlcData = ((ushort)s7.Read(Address6)).ConvertToShort();
|
|
|
- if (MyPlcData != 1)
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress3))
|
|
|
{
|
|
|
- responseData.result = "false";
|
|
|
- Log.Instance.WriteLogAdd(ActionTypeEnum.SendServoStacker + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
- EnumHelper.GetDescription(ActionTypeEnum.SendServoStacker));
|
|
|
- s7.Close();
|
|
|
- return responseData;
|
|
|
+ string CheckAddress3 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress3);
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress3)).ConvertToShort();
|
|
|
+ if (actionInfo.CheckType3 ? operateResult.ToString() == actionInfo.CheckValue3 : operateResult.ToString() != actionInfo.CheckValue3)
|
|
|
+ {
|
|
|
+ s7.Close();
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.SendServoStacker + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendServoStacker));
|
|
|
+ responseData.result = "false";
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress4))
|
|
|
+ {
|
|
|
+ string CheckAddress4 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress4);
|
|
|
+
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress4)).ConvertToShort();
|
|
|
+
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString() == actionInfo.CheckValue4 : operateResult.ToString() != actionInfo.CheckValue4)
|
|
|
+ {
|
|
|
+ responseData.result = "false";
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.SendServoStacker + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendServoStacker));
|
|
|
+ s7.Close();
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(actionInfo.CheckAddress5))
|
|
|
+ {
|
|
|
+ string CheckAddress5 = ToolUtils.AddressConvertDBW(actionInfo.CheckAddress5);
|
|
|
+
|
|
|
+ var operateResult = ((ushort)s7.Read(CheckAddress5)).ConvertToShort();
|
|
|
+
|
|
|
+ if (actionInfo.CheckType ? operateResult.ToString() == actionInfo.CheckValue5 : operateResult.ToString() != actionInfo.CheckValue5)
|
|
|
+ {
|
|
|
+ responseData.result = "false";
|
|
|
+ Log.Instance.WriteLogAdd(ActionTypeEnum.SendServoStacker + "放物品故障===>>" + JsonConvert.SerializeObject(req),
|
|
|
+ EnumHelper.GetDescription(ActionTypeEnum.SendServoStacker));
|
|
|
+ s7.Close();
|
|
|
+ return responseData;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
string Address1 = ToolUtils.AddressConvertDBW(actionInfo.Address);
|
|
@@ -1404,7 +1539,7 @@ namespace IMCS.CCS.Services
|
|
|
TaskCallback taskCallbackData = new TaskCallback(req.url, ActionTypeEnum.SendServoStacker.ToString(),
|
|
|
EnumHelper.GetDescription(ActionTypeEnum.SendServoStacker), req.taskId, req.taskNodeId, actionInfo.Address2, actionInfo.CallbackValue);
|
|
|
|
|
|
- taskCallbackData.Address3 = Address5;
|
|
|
+ taskCallbackData.Address3 = actionInfo.Address5;
|
|
|
taskCallbackData.CallbackValue2 = actionInfo.CallbackValue2;
|
|
|
taskCallbackData.CallbackValue3 = actionInfo.CallbackValue3;
|
|
|
await _taskCallbackService.Create(taskCallbackData);
|
|
@@ -1502,7 +1637,7 @@ namespace IMCS.CCS.Services
|
|
|
actionQuery.Ip = req.url;
|
|
|
actionQuery.OrderIndex = req.data.orderIndex;
|
|
|
List<CcsAction> actions = _ccsActionService.GetList(actionQuery);
|
|
|
- CcsAction actionInfo = actions[0];
|
|
|
+ CcsAction actionInfo = actions[0];
|
|
|
string Content = req.data.content;
|
|
|
|
|
|
Plc s7 = DevicePlcS7.S7(req.url, ProtocalTypeEnum.S7_1500.ToString());
|
|
@@ -1572,7 +1707,7 @@ namespace IMCS.CCS.Services
|
|
|
actionQuery.Ip = req.url;
|
|
|
actionQuery.OrderIndex = req.data.orderIndex;
|
|
|
List<CcsAction> actions = _ccsActionService.GetList(actionQuery);
|
|
|
- CcsAction actionInfo = actions[0];
|
|
|
+ CcsAction actionInfo = actions[0];
|
|
|
string Content = req.data.content;
|
|
|
|
|
|
Plc s7 = DevicePlcS7.S7(req.url, ProtocalTypeEnum.S7_1500.ToString());
|