|
|
@@ -962,11 +962,14 @@ namespace TeamAAS_VP.Core
|
|
|
addressConfig.In_FixedCameracheckExe.Address,
|
|
|
addressConfig.In_WorkStart.Address,
|
|
|
addressConfig.In_WorkDone.Address,
|
|
|
- addressConfig.In_MesCheck.Address,
|
|
|
addressConfig.In_RequestPosition.Address,
|
|
|
addressConfig.In_ScrewTeachExe.Address,
|
|
|
addressConfig.In_PickINC.Address,
|
|
|
};
|
|
|
+ for (int i = 0; i < 10; i++)
|
|
|
+ {
|
|
|
+ monitorNodeIds.Add(string.Format(addressConfig.In_MesCheck.Address, i));
|
|
|
+ }
|
|
|
|
|
|
//订阅PLC地址变化
|
|
|
plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger);
|
|
|
@@ -1069,13 +1072,14 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
|
|
|
//获取产品编码
|
|
|
- _productService.CurrentProductCode = plc.ReadNode<string>(addressConfig.In_Code.Address);
|
|
|
+ _productService.CurrentProductCode = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, 0));
|
|
|
//如果产品编码为空,则以当前的时间戳作为编码
|
|
|
if (string.IsNullOrEmpty(_productService.CurrentProductCode))
|
|
|
{
|
|
|
_productService.CurrentProductCode = DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
bool isDryMode = plc.ReadNode<bool>(addressConfig.In_DryMode.Address);
|
|
|
|
|
|
// 触发下相机拍照
|
|
|
@@ -1784,33 +1788,6 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // 过站检查
|
|
|
- else if (addressConfig.In_MesCheck.Address.Contains(tuple.nodeId))
|
|
|
- {
|
|
|
- if (tuple.value is Int16 state)
|
|
|
- {
|
|
|
- if (state == 1)
|
|
|
- {
|
|
|
- SendTaskMessage($"收到过站检查请求(当站是否生产)...", MessageLevel.Debug);
|
|
|
-
|
|
|
- //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
-
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_MesStatus.Address, (Int16)1);
|
|
|
- }
|
|
|
- // 上传本站数据
|
|
|
- else if (state == 2)
|
|
|
- {
|
|
|
- SendTaskMessage($"收到上传本站数据请求...", MessageLevel.Debug);
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_MesStatus.Address, (Int16)3);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SendTaskMessage($"过站检查信号:state={state},处理为默认状态", MessageLevel.Alarm);
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_MesStatus.Address, (Int16)0);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
// 螺丝供料器螺丝递减
|
|
|
else if (addressConfig.In_PickINC.Address.Contains(tuple.nodeId))
|
|
|
{
|
|
|
@@ -1824,7 +1801,46 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ // 过站检查
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int i = 0; i < 10; i++)
|
|
|
+ {
|
|
|
+ if (string.Format(addressConfig.In_MesCheck.Address, i).Contains(tuple.nodeId))
|
|
|
+ {
|
|
|
+ if (tuple.value is Int16 state)
|
|
|
+ {
|
|
|
+ if (state == 1)
|
|
|
+ {
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ SendTaskMessage($"收到当前站过站检查请求(当站是否生产)...", MessageLevel.Debug);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SendTaskMessage($"收到 {i} 过站检查请求(当站是否生产)...", MessageLevel.Debug);
|
|
|
+ }
|
|
|
+
|
|
|
+ //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
+
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
|
|
|
+ }
|
|
|
+ // 上传本站数据
|
|
|
+ else if (state == 2)
|
|
|
+ {
|
|
|
+ SendTaskMessage($"收到上传{i}站数据请求...", MessageLevel.Debug);
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SendTaskMessage($"{i}过站检查信号:state={state},处理为默认状态", MessageLevel.Alarm);
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
SendTaskMessage(ex.Message, MessageLevel.Error);
|