|
@@ -1,4 +1,5 @@
|
|
|
using Cognex.VisionPro.ToolBlock;
|
|
using Cognex.VisionPro.ToolBlock;
|
|
|
|
|
+using MahApps.Metro.Controls;
|
|
|
using NPOI.OpenXmlFormats.Vml;
|
|
using NPOI.OpenXmlFormats.Vml;
|
|
|
using Org.BouncyCastle.Crypto;
|
|
using Org.BouncyCastle.Crypto;
|
|
|
using Prism.Events;
|
|
using Prism.Events;
|
|
@@ -1214,7 +1215,7 @@ namespace TeamAAS_VP.Core
|
|
|
monitorNodeIds.Add(string.Format(addressConfig.In_MesCheck.Address, i));
|
|
monitorNodeIds.Add(string.Format(addressConfig.In_MesCheck.Address, i));
|
|
|
}
|
|
}
|
|
|
//订阅PLC地址变化
|
|
//订阅PLC地址变化
|
|
|
- plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger,OpcUaSubscriptionMode.CustomPolling);
|
|
|
|
|
|
|
+ plc.SubscribeNodes("AutoSensor", monitorNodeIds, PlcCommandTrigger, OpcUaSubscriptionMode.CustomPolling);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -1776,11 +1777,6 @@ namespace TeamAAS_VP.Core
|
|
|
var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, num, null, null);
|
|
var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, num, null, null);
|
|
|
if (visionResult.IsSucceed)
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- //if ()
|
|
|
|
|
- //{
|
|
|
|
|
-
|
|
|
|
|
- //}
|
|
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
|
|
await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
|
|
|
SendTaskMessage($"点位{cameraIndex}检测OK", MessageLevel.Debug);
|
|
SendTaskMessage($"点位{cameraIndex}检测OK", MessageLevel.Debug);
|
|
|
}
|
|
}
|
|
@@ -2110,20 +2106,48 @@ namespace TeamAAS_VP.Core
|
|
|
plcPoints.Add(item);
|
|
plcPoints.Add(item);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- var point = plcPoints[positionIndex - 1];
|
|
|
|
|
- if (point == null)
|
|
|
|
|
|
|
+ var TempPoint = plcPoints[positionIndex - 1];
|
|
|
|
|
+ if (TempPoint == null)
|
|
|
{
|
|
{
|
|
|
SendTaskMessage($"点:{positionIndex}不存在", MessageLevel.Info);
|
|
SendTaskMessage($"点:{positionIndex}不存在", MessageLevel.Info);
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
|
|
await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- point = point.Clone();
|
|
|
|
|
- point.X_Position = UpCameraPutResults[1].X + DowmCameraResults[1].X;
|
|
|
|
|
- point.Y_Position = UpCameraPutResults[1].Y + DowmCameraResults[1].Y;
|
|
|
|
|
- SendTaskMessage($"点:{positionIndex},{point.X_Position:F3},{point.Y_Position:F4}", MessageLevel.Info);
|
|
|
|
|
- await point.WriteToPlcAddress(addressConfig.Out_Screw, plc, positionIndex);
|
|
|
|
|
|
|
+ var PositionPoint = TempPoint.Clone();
|
|
|
|
|
+ PositionPoint.X_Position = UpCameraPutResults[1].X + DowmCameraResults[1].X;
|
|
|
|
|
+ PositionPoint.Y_Position = UpCameraPutResults[1].Y + DowmCameraResults[1].Y;
|
|
|
|
|
+ SendTaskMessage($"点:{positionIndex},{PositionPoint.X_Position:F3},{PositionPoint.Y_Position:F4}", MessageLevel.Info);
|
|
|
|
|
+ if (PositionPoint.X_Position == 0 || PositionPoint.Y_Position == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ SendTaskMessage("拟合位置为0,请检查", MessageLevel.Error);
|
|
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ //验证当前锁附点位与设置锁附点位的差值是否超限,超限则报警并停止流程
|
|
|
|
|
+ //目前验证已OK 缺少切换按钮
|
|
|
|
|
+ //try
|
|
|
|
|
+ //{
|
|
|
|
|
+ // var ScrewLimit = currentProduct.GlobalParamListCollection.FirstOrDefault((p) => p.Number == positionIndex - 1);
|
|
|
|
|
+ // //判断实际偏差与设置的点位差数是否偏差过大
|
|
|
|
|
+ // float XOffsetPoint = Math.Abs(PositionPoint.X_Position - (TempPoint.X_Position + TempPoint.X_Offset));
|
|
|
|
|
+ // float YOffsetPoint = Math.Abs(PositionPoint.Y_Position - (TempPoint.Y_Position + TempPoint.Y_Offset));
|
|
|
|
|
+ // if (!(XOffsetPoint >= float.Parse(ScrewLimit.Param1) && XOffsetPoint <= float.Parse(ScrewLimit.Param2)) ||
|
|
|
|
|
+ // !(YOffsetPoint >= float.Parse(ScrewLimit.Param3) && YOffsetPoint <= float.Parse(ScrewLimit.Param4)))
|
|
|
|
|
+ // {
|
|
|
|
|
+ // SendTaskMessage($"当前锁附点位{positionIndex}与设置锁附点位差值超限,X偏差:{XOffsetPoint},Y偏差{YOffsetPoint}", MessageLevel.Error);
|
|
|
|
|
+ // await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
|
|
|
|
|
+ // return;
|
|
|
|
|
+ // }
|
|
|
|
|
+ //}
|
|
|
|
|
+ //catch (Exception ex)
|
|
|
|
|
+ //{
|
|
|
|
|
+ // SendTaskMessage($"当前锁附点位与设置锁附点位差值未设置:" + ex.Message, MessageLevel.Error);
|
|
|
|
|
+ // await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
|
|
|
|
|
+ // return;
|
|
|
|
|
+ //}
|
|
|
|
|
+ await PositionPoint.WriteToPlcAddress(addressConfig.Out_Screw, plc, positionIndex);
|
|
|
}
|
|
}
|
|
|
- //拍1打所有
|
|
|
|
|
|
|
+ //拍2打所有
|
|
|
else if (systemConfig.WorkMode == 2)
|
|
else if (systemConfig.WorkMode == 2)
|
|
|
{
|
|
{
|
|
|
//根据UpCameraPutResults[]中的索引1、2,和拍照点对应的Local下的坐标,从创建Local坐标系
|
|
//根据UpCameraPutResults[]中的索引1、2,和拍照点对应的Local下的坐标,从创建Local坐标系
|
|
@@ -2146,6 +2170,25 @@ namespace TeamAAS_VP.Core
|
|
|
point.X_Position = (float)worldPoint[0];
|
|
point.X_Position = (float)worldPoint[0];
|
|
|
point.Y_Position = (float)worldPoint[1];
|
|
point.Y_Position = (float)worldPoint[1];
|
|
|
SendTaskMessage($"点:{i},{point.X_Position:F3},{point.Y_Position:F4}", MessageLevel.Info);
|
|
SendTaskMessage($"点:{i},{point.X_Position:F3},{point.Y_Position:F4}", MessageLevel.Info);
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ var ScrewLimit = currentProduct.GlobalParamListCollection.FirstOrDefault((p) => p.Number == positionIndex - 1);
|
|
|
|
|
+ //判断实际偏差与设置的点位差数是否偏差过大
|
|
|
|
|
+ float XOffsetPoint = Math.Abs(localPoint.X - (float)worldPoint[0]);
|
|
|
|
|
+ float YOffsetPoint = Math.Abs(localPoint.Y - (float)worldPoint[1]);
|
|
|
|
|
+ if ((XOffsetPoint >= float.Parse(ScrewLimit.Param1) && XOffsetPoint <= float.Parse(ScrewLimit.Param2)) ||
|
|
|
|
|
+ (YOffsetPoint >= float.Parse(ScrewLimit.Param3) && YOffsetPoint <= float.Parse(ScrewLimit.Param4)))
|
|
|
|
|
+ {
|
|
|
|
|
+ SendTaskMessage($"当前锁附点位{i}与设置锁附点位差值超限,X偏差:{XOffsetPoint},Y偏差{YOffsetPoint}", MessageLevel.Error);
|
|
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (Exception ex)
|
|
|
|
|
+ {
|
|
|
|
|
+ SendTaskMessage($"当前锁附点位与设置锁附点位差值超限:" + ex.Message, MessageLevel.Error);
|
|
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
|
|
|
|
|
+ }
|
|
|
await point.WriteToPlcAddress(addressConfig.Out_Screw, plc);
|
|
await point.WriteToPlcAddress(addressConfig.Out_Screw, plc);
|
|
|
}
|
|
}
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)currentProduct.ScrewPoints.Count);
|
|
await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)currentProduct.ScrewPoints.Count);
|
|
@@ -2418,7 +2461,7 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
{
|
|
|
code = outputCollection["QR"].Value as string;
|
|
code = outputCollection["QR"].Value as string;
|
|
|
code = code.ToUpper();
|
|
code = code.ToUpper();
|
|
|
- if (!string.IsNullOrEmpty(code)&&code.Length>5)
|
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(code) && code.Length > 5)
|
|
|
{
|
|
{
|
|
|
if (systemConfig.IsBasePartCodeChooseScrew)//是否基于零件码,判断是不是当站要打的螺丝
|
|
if (systemConfig.IsBasePartCodeChooseScrew)//是否基于零件码,判断是不是当站要打的螺丝
|
|
|
{
|
|
{
|
|
@@ -2466,7 +2509,7 @@ namespace TeamAAS_VP.Core
|
|
|
//获取过站时间
|
|
//获取过站时间
|
|
|
_LastMesCheckTime[i] = (await _mesService.GetServerTimeAsync(i, code, 2)).Now;
|
|
_LastMesCheckTime[i] = (await _mesService.GetServerTimeAsync(i, code, 2)).Now;
|
|
|
if (_configService.GetDeviceInfo().EnableMES)
|
|
if (_configService.GetDeviceInfo().EnableMES)
|
|
|
- {
|
|
|
|
|
|
|
+ {
|
|
|
LogHelper.WriteLogMes($"【mes开始QUERY】");
|
|
LogHelper.WriteLogMes($"【mes开始QUERY】");
|
|
|
SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
|
|
SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
|
|
|
//dataToMes.Clear();
|
|
//dataToMes.Clear();
|
|
@@ -2626,7 +2669,7 @@ namespace TeamAAS_VP.Core
|
|
|
if (i == 0)
|
|
if (i == 0)
|
|
|
{
|
|
{
|
|
|
_productService.CurrentProductCode = ProductMainSN[i];
|
|
_productService.CurrentProductCode = ProductMainSN[i];
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
|
|
SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
|
|
|
}
|
|
}
|
|
|
string woItem = item.FirstOrDefault(f => f.Contains("wo="));
|
|
string woItem = item.FirstOrDefault(f => f.Contains("wo="));
|
|
@@ -2748,7 +2791,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
}
|
|
|
// 上传本站数据
|
|
// 上传本站数据
|
|
|
else if (state == 2)
|
|
else if (state == 2)
|
|
|
- {
|
|
|
|
|
|
|
+ {
|
|
|
DFC.Clear();//CTQ数据集合
|
|
DFC.Clear();//CTQ数据集合
|
|
|
|
|
|
|
|
//获取当前工位的配置
|
|
//获取当前工位的配置
|
|
@@ -2892,17 +2935,17 @@ namespace TeamAAS_VP.Core
|
|
|
PD_ATTR_03 = "NA",
|
|
PD_ATTR_03 = "NA",
|
|
|
PD_ATTR_04 = productSn,
|
|
PD_ATTR_04 = productSn,
|
|
|
PD_ATTR_05 = "NA",
|
|
PD_ATTR_05 = "NA",
|
|
|
- });
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
if (systemConfig.IsBasePartOpenLightKB)
|
|
if (systemConfig.IsBasePartOpenLightKB)
|
|
|
{
|
|
{
|
|
|
string midValue = "999", saveppid = "NA";
|
|
string midValue = "999", saveppid = "NA";
|
|
|
double upvlalue = 0, doenvlaue = 0;
|
|
double upvlalue = 0, doenvlaue = 0;
|
|
|
if (stationConfig.SaveCsvPPID) saveppid = ppid[i];
|
|
if (stationConfig.SaveCsvPPID) saveppid = ppid[i];
|
|
|
- bool pressureRes=true;
|
|
|
|
|
|
|
+ bool pressureRes = true;
|
|
|
foreach (var item in mes_cc)
|
|
foreach (var item in mes_cc)
|
|
|
{
|
|
{
|
|
|
- switch(item.Key)
|
|
|
|
|
|
|
+ switch (item.Key)
|
|
|
{
|
|
{
|
|
|
case "1":
|
|
case "1":
|
|
|
upvlalue = Convert.ToDouble(currentProduct.GlobalParamEx.CC1DownLimit.ToString("F3"));
|
|
upvlalue = Convert.ToDouble(currentProduct.GlobalParamEx.CC1DownLimit.ToString("F3"));
|
|
@@ -2913,13 +2956,13 @@ namespace TeamAAS_VP.Core
|
|
|
upvlalue = Convert.ToDouble(currentProduct.GlobalParamEx.CC2DownLimit.ToString("F3"));
|
|
upvlalue = Convert.ToDouble(currentProduct.GlobalParamEx.CC2DownLimit.ToString("F3"));
|
|
|
doenvlaue = Convert.ToDouble(currentProduct.GlobalParamEx.CC2UpLimit.ToString("F3"));
|
|
doenvlaue = Convert.ToDouble(currentProduct.GlobalParamEx.CC2UpLimit.ToString("F3"));
|
|
|
midValue = ((currentProduct.GlobalParamEx.CC2DownLimit + currentProduct.GlobalParamEx.CC2UpLimit) / 2).ToString("F3");
|
|
midValue = ((currentProduct.GlobalParamEx.CC2DownLimit + currentProduct.GlobalParamEx.CC2UpLimit) / 2).ToString("F3");
|
|
|
- break;
|
|
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
- if (doenvlaue<= currentProduct.GlobalParamEx.CC1DownLimit|| doenvlaue >= currentProduct.GlobalParamEx.CC1UpLimit)
|
|
|
|
|
|
|
+ if (doenvlaue <= currentProduct.GlobalParamEx.CC1DownLimit || doenvlaue >= currentProduct.GlobalParamEx.CC1UpLimit)
|
|
|
{
|
|
{
|
|
|
pressureRes = false;
|
|
pressureRes = false;
|
|
|
}
|
|
}
|
|
|
- if (doenvlaue <= currentProduct.GlobalParamEx.CC2DownLimit|| doenvlaue >= currentProduct.GlobalParamEx.CC2UpLimit)
|
|
|
|
|
|
|
+ if (doenvlaue <= currentProduct.GlobalParamEx.CC2DownLimit || doenvlaue >= currentProduct.GlobalParamEx.CC2UpLimit)
|
|
|
{
|
|
{
|
|
|
pressureRes = false;
|
|
pressureRes = false;
|
|
|
}
|
|
}
|
|
@@ -3093,7 +3136,7 @@ namespace TeamAAS_VP.Core
|
|
|
WriteProductLog(lockResultsAll, ProductMainSN[i], CTtime);
|
|
WriteProductLog(lockResultsAll, ProductMainSN[i], CTtime);
|
|
|
mes_cc.Clear();
|
|
mes_cc.Clear();
|
|
|
LogHelper.WriteLogMes($"【mes结束ADD】");
|
|
LogHelper.WriteLogMes($"【mes结束ADD】");
|
|
|
- SendTaskMessage($"mes结束ADD", MessageLevel.Info);
|
|
|
|
|
|
|
+ SendTaskMessage($"mes结束ADD", MessageLevel.Info);
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|