|
|
@@ -1400,7 +1400,23 @@ namespace TeamAAS_VP.Core
|
|
|
monitorNodeIds.Add(string.Format(addressConfig.In_MesCheck.Address, i));
|
|
|
}
|
|
|
//订阅PLC地址变化
|
|
|
+ //plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger, OpcUaSubscriptionMode.CustomPolling);
|
|
|
+ // 1. 初始订阅(使用原生模式)
|
|
|
plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger, OpcUaSubscriptionMode.CustomPolling);
|
|
|
+
|
|
|
+ // 2. 监听重连事件,重连成功后自动重新订阅
|
|
|
+ plc.ConnectChangedEvent -= Plc_ConnectChanged; // 防止重复注册
|
|
|
+ plc.ConnectChangedEvent += Plc_ConnectChanged;
|
|
|
+
|
|
|
+ // 定义重连处理方法(写在同一个类里即可)
|
|
|
+ void Plc_ConnectChanged(object sender, bool isConnected)
|
|
|
+ {
|
|
|
+ if (isConnected)
|
|
|
+ {
|
|
|
+ // 重连成功后,重新订阅节点
|
|
|
+ plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger, OpcUaSubscriptionMode.CustomPolling);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -1778,6 +1794,8 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
if (currentProduct.ID != productId || productWithMes.ProductKBSN != kb_sn)
|
|
|
{
|
|
|
+
|
|
|
+ _productService.Clear();
|
|
|
//切换产品
|
|
|
_productService.LoadProduct(productId);
|
|
|
_productService.SetCurrentProduct(productId);
|
|
|
@@ -2459,6 +2477,8 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //翻转相机检测拍照
|
|
|
+
|
|
|
//切换成自动运行模式
|
|
|
else if (addressConfig.AutoRunning.Address.Contains(tuple.nodeId))
|
|
|
{
|
|
|
@@ -2968,6 +2988,11 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //测试使用,强制上传mes为pass
|
|
|
+ //if (sysConfig.IsMesResult)
|
|
|
+ //{
|
|
|
+ // resultToMes.Clear();
|
|
|
+ //}
|
|
|
bool recordResult = RecordStationResult(i, DFC, ProductMainSN, serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds, _LastMesCheckTime[i], stationConfig.SaveCsvPath);
|
|
|
// bool recordResult1 = WriteProductLog( ProductMainSN, serverTimeResult.Now.Subtract(_LastMesCheckTime[i]).TotalSeconds, _LastMesCheckTime[i], stationConfig.SaveCsvPath, DFC);
|
|
|
|
|
|
@@ -3905,6 +3930,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
#region 键盘相邻关系
|
|
|
/// <summary>
|
|
|
/// 键盘相邻关系-US
|