|
|
@@ -1,5 +1,6 @@
|
|
|
using Cognex.VisionPro.ToolBlock;
|
|
|
using MathNet.Numerics.LinearAlgebra;
|
|
|
+using NPOI.SS.Formula.Functions;
|
|
|
using OpenCvSharp;
|
|
|
using Prism.Events;
|
|
|
using Prism.Ioc;
|
|
|
@@ -1188,13 +1189,13 @@ namespace TeamAAS_VP.Core
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- ////获取产品编码
|
|
|
- //_productService.CurrentProductCode = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, 0));
|
|
|
- ////如果产品编码为空,则以当前的时间戳作为编码
|
|
|
- //if (string.IsNullOrEmpty(_productService.CurrentProductCode))
|
|
|
- //{
|
|
|
- // _productService.CurrentProductCode = DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|
|
- //}
|
|
|
+ //获取产品编码
|
|
|
+ _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);
|
|
|
@@ -2185,6 +2186,11 @@ namespace TeamAAS_VP.Core
|
|
|
if (visionResults[0].IsSucceed && visionResults[1].IsSucceed && visionResults[2].IsSucceed && visionResults[3].IsSucceed)
|
|
|
{
|
|
|
SendTaskMessage($"固定相机检测OK", MessageLevel.Debug);
|
|
|
+ SendTaskMessage($"流程1结果:{visionResults[0].distance}", MessageLevel.Debug);
|
|
|
+ SendTaskMessage($"流程2结果:{visionResults[1].distance}", MessageLevel.Debug);
|
|
|
+ SendTaskMessage($"流程3结果:{visionResults[2].distance}", MessageLevel.Debug);
|
|
|
+ SendTaskMessage($"流程4结果:{visionResults[3].distance}", MessageLevel.Debug);
|
|
|
+
|
|
|
gapString = $"1-{visionResults[0].distance.Split(',')[1]},2-{visionResults[1].distance.Split(',')[1]},3-{visionResults[2].distance.Split(',')[1]},4-{visionResults[3].distance.Split(',')[1]}";
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_FixedCameracheckStatus.Address, (Int16)1);
|
|
|
return;
|
|
|
@@ -2374,6 +2380,7 @@ namespace TeamAAS_VP.Core
|
|
|
PartSN = outputCollection["QR"].Value as string;
|
|
|
if (!string.IsNullOrEmpty(PartSN))
|
|
|
{
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_PartCode.Address, PartSN);
|
|
|
SendTaskMessage($"二维码扫码成功:{PartSN}", MessageLevel.Info);
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)1);
|
|
|
}
|
|
|
@@ -2541,6 +2548,14 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"工单信息:{wo[i]}", MessageLevel.Info);
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ProductMainSN[i] = DateTime.Now.ToString();
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ _productService.CurrentProductCode = ProductMainSN[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
LogHelper.WriteLogMes($"询问mes成功");
|
|
|
SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
|
|
|
@@ -2577,6 +2592,10 @@ namespace TeamAAS_VP.Core
|
|
|
CTtime = ct;
|
|
|
}
|
|
|
|
|
|
+ //从PLC获取零件编号
|
|
|
+ PartSN = plc.ReadNode<string>(addressConfig.In_PartCode.Address);
|
|
|
+ comp = PartSN;
|
|
|
+
|
|
|
//读取产品结果
|
|
|
Int16 resultIndex = plc.ReadNode<Int16>(string.Format(addressConfig.In_Result.Address, i));
|
|
|
resultIndex = 1;
|
|
|
@@ -2949,6 +2968,7 @@ namespace TeamAAS_VP.Core
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
SendTaskMessage(ex.Message, MessageLevel.Error);
|
|
|
+ LogHelper.WriteLogError("PLC命令执行时出错!", ex);
|
|
|
}
|
|
|
}
|
|
|
|