|
|
@@ -120,17 +120,6 @@ namespace TeamAAS_VP.Core
|
|
|
set { SetProperty(ref _Renders, value); }
|
|
|
}
|
|
|
|
|
|
- private ProductModel _CurrentProduct;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 当前产品
|
|
|
- /// </summary>
|
|
|
- public ProductModel CurrentProduct
|
|
|
- {
|
|
|
- get { return _CurrentProduct; }
|
|
|
- set { SetProperty(ref _CurrentProduct, value); }
|
|
|
- }
|
|
|
-
|
|
|
public BgCommunicate BgCommunicate { get; private set; }
|
|
|
|
|
|
public BgModbusTcpCommunicate BgModbusTcpCommunicate { get; private set; }
|
|
|
@@ -1093,6 +1082,18 @@ namespace TeamAAS_VP.Core
|
|
|
/// 移动向下相机拍照结果
|
|
|
/// </summary>
|
|
|
OpenCvSharp.Point3f[] UpCameraPutResults = new OpenCvSharp.Point3f[10];
|
|
|
+ /// <summary>
|
|
|
+ /// 取料移动相机拍照结果
|
|
|
+ /// </summary>
|
|
|
+ OpenCvSharp.Point3f UpCameraPickResult = new OpenCvSharp.Point3f();
|
|
|
+ /// <summary>
|
|
|
+ /// 最终组装位置
|
|
|
+ /// </summary>
|
|
|
+ OpenCvSharp.Point3f PlaceActualCoord = new OpenCvSharp.Point3f();
|
|
|
+ /// <summary>
|
|
|
+ /// 零件SN
|
|
|
+ /// </summary>
|
|
|
+ string PartSN = "";
|
|
|
|
|
|
/// <summary>
|
|
|
/// 二次定位相机的工具坐标
|
|
|
@@ -1197,7 +1198,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, null);
|
|
|
if (isDryMode)
|
|
|
{
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)1);
|
|
|
@@ -1239,8 +1240,8 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
- var task1 = _remoteCommandService.ExecutePhotoGetSinglePoint(process1, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
- var task2 = _remoteCommandService.ExecutePhotoGetSinglePoint(process2, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
+ var task1 = _remoteCommandService.ExecutePhotoGetSinglePoint(process1, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, 1, null);
|
|
|
+ var task2 = _remoteCommandService.ExecutePhotoGetSinglePoint(process2, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, 2, null);
|
|
|
var visionResults = await Task.WhenAll(task1, task2);
|
|
|
if (isDryMode)
|
|
|
{
|
|
|
@@ -1331,8 +1332,8 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
- var task1 = _remoteCommandService.ExecutePhotoGetSinglePoint(process1, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
- var task2 = _remoteCommandService.ExecutePhotoGetSinglePoint(process2, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
+ var task1 = _remoteCommandService.ExecutePhotoGetSinglePoint(process1, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, 1, null);
|
|
|
+ var task2 = _remoteCommandService.ExecutePhotoGetSinglePoint(process2, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, 2, null);
|
|
|
var visionResults = await Task.WhenAll(task1, task2);
|
|
|
if (isDryMode)
|
|
|
{
|
|
|
@@ -1483,7 +1484,7 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, null);
|
|
|
if (visionResult.IsSucceed)
|
|
|
{
|
|
|
currentProduct.PickPoints[0].X_Position = (float)visionResult.X;
|
|
|
@@ -1519,8 +1520,8 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
- var task1 = _remoteCommandService.ExecutePhotoGetSinglePoint(process1, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
- var task2 = _remoteCommandService.ExecutePhotoGetSinglePoint(process2, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
+ var task1 = _remoteCommandService.ExecutePhotoGetSinglePoint(process1, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, 1, null);
|
|
|
+ var task2 = _remoteCommandService.ExecutePhotoGetSinglePoint(process2, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, 2, null);
|
|
|
var visionResults = await Task.WhenAll(task1, task2);
|
|
|
if (visionResults[0].IsSucceed && visionResults[1].IsSucceed)
|
|
|
{
|
|
|
@@ -1611,7 +1612,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
- var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
+ var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, null);
|
|
|
if (isDryMode)
|
|
|
{
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_UpCameraPutStatus.Address, (Int16)1);
|
|
|
@@ -1650,8 +1651,8 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
// 执行视觉任务
|
|
|
var _cts = new CancellationTokenSource();
|
|
|
- var task1 = _remoteCommandService.ExecutePhotoGetSinglePoint(process1, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
- var task2 = _remoteCommandService.ExecutePhotoGetSinglePoint(process2, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token);
|
|
|
+ var task1 = _remoteCommandService.ExecutePhotoGetSinglePoint(process1, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, 1, null);
|
|
|
+ var task2 = _remoteCommandService.ExecutePhotoGetSinglePoint(process2, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, 2, null);
|
|
|
var visionResults = await Task.WhenAll(task1, task2);
|
|
|
if (isDryMode)
|
|
|
{
|
|
|
@@ -1855,6 +1856,7 @@ namespace TeamAAS_VP.Core
|
|
|
point.X_Position = (float)p0[0];
|
|
|
point.Y_Position = (float)p0[1];
|
|
|
point.U_Position = (float)angle;
|
|
|
+ PlaceActualCoord = new OpenCvSharp.Point3f(point.X_Position, point.Y_Position, point.U_Position);
|
|
|
SendTaskMessage($"点:1,{point.X_Position:F3},{point.Y_Position:F4},{point.U_Position:F4}", MessageLevel.Info);
|
|
|
await point.WriteToPlcAddress(addressConfig.Out_Screw, plc);
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)1);
|
|
|
@@ -1945,16 +1947,40 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"收到{i}上传本站数据请求...", MessageLevel.Debug);
|
|
|
|
|
|
//这里缺少上传MES的本站数据结果及开始和结束时间,需要补充
|
|
|
+ double ct = DateTime.UtcNow.Subtract(_LastMesCheckTime[i]).TotalSeconds;
|
|
|
if (i == 0)
|
|
|
{
|
|
|
- CTtime = DateTime.UtcNow.Subtract(_LastMesCheckTime[i]).TotalSeconds;
|
|
|
+ CTtime = ct;
|
|
|
}
|
|
|
|
|
|
//读取产品结果
|
|
|
Int16 resultIndex = plc.ReadNode<Int16>(string.Format(addressConfig.In_Result.Address, i));
|
|
|
+ //读取压力值
|
|
|
+ float pressure = plc.ReadNode<float>(string.Format(addressConfig.In_PressureValue.Address, i));
|
|
|
+ AssemblyRecord assemblyRecord = new AssemblyRecord();
|
|
|
+ assemblyRecord.ProductSN = code;
|
|
|
+ assemblyRecord.RecipeName = currentProduct.Name;
|
|
|
+ assemblyRecord.PartSN = PartSN;
|
|
|
+ assemblyRecord.AssemblyDurationSeconds = ct;
|
|
|
+ assemblyRecord.AssemblyPressure = pressure;
|
|
|
+ assemblyRecord.DeviceId = i;
|
|
|
+ assemblyRecord.DeviceName = $"";
|
|
|
+ assemblyRecord.OperatorName = _systemDatabaseService.GetCurrentUser().UserName;
|
|
|
+ assemblyRecord.Success = resultIndex == 1 ? true : false;
|
|
|
+ assemblyRecord.DownCameraCoord1 = "";
|
|
|
+ assemblyRecord.DownCameraCoord2 = "";
|
|
|
+ assemblyRecord.DownCameraCoord3 = "";
|
|
|
+ assemblyRecord.DownCameraCoord4 = "";
|
|
|
+ assemblyRecord.PickMoveCameraCoord = "";
|
|
|
+ assemblyRecord.PlaceMoveCameraCoord1 = "";
|
|
|
+ assemblyRecord.PlaceMoveCameraCoord2 = "";
|
|
|
+ assemblyRecord.PlaceMoveCameraCoord3 = "";
|
|
|
+ assemblyRecord.PlaceMoveCameraCoord4 = "";
|
|
|
+ assemblyRecord.PlaceActualCoord = "";
|
|
|
|
|
|
//目前只记录当前站
|
|
|
if (i == 0)
|
|
|
+ {
|
|
|
await _systemDatabaseService.RecordProductionAsync(new ProductionRecord()
|
|
|
{
|
|
|
ProductName = currentProduct.Name,
|
|
|
@@ -1965,6 +1991,17 @@ namespace TeamAAS_VP.Core
|
|
|
Quantity = 1,
|
|
|
Remark = $"TotalSeconds:{DateTime.UtcNow.Subtract(_LastMesCheckTime[i]).TotalSeconds.ToString("F2")}",
|
|
|
});
|
|
|
+ assemblyRecord.DownCameraCoord1 = $"{DowmCameraResults[1].X:F3},{DowmCameraResults[1].Y:F3},{DowmCameraResults[1].Z:F3}";
|
|
|
+ assemblyRecord.PlaceMoveCameraCoord1 = $"{UpCameraPutResults[1].X:F3},{UpCameraPutResults[1].Y:F3},{UpCameraPutResults[1].Z:F3}";
|
|
|
+ assemblyRecord.PlaceMoveCameraCoord2 = $"{UpCameraPutResults[2].X:F3},{UpCameraPutResults[2].Y:F3},{UpCameraPutResults[2].Z:F3}";
|
|
|
+ assemblyRecord.PlaceActualCoord = $"{PlaceActualCoord.X:F3},{PlaceActualCoord.Y:F3},{PlaceActualCoord.Z:F3}";
|
|
|
+ App.Current.Dispatcher.Invoke(() =>
|
|
|
+ {
|
|
|
+ _eventAggregator.GetEvent<AssemblyFinishNotification>().Publish(assemblyRecord);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ await _systemDatabaseService.RecordAssemblyAsync(assemblyRecord);
|
|
|
|
|
|
(bool isSuccess, string response) = await _mesService.SubmitGetAsync(code, resultIndex == 1 ? true : false, _LastMesCheckTime[i], DateTime.UtcNow);
|
|
|
//假设上传成功,这里缺少上传失败的处理
|
|
|
@@ -2276,12 +2313,12 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- if (CurrentProduct == null) return;
|
|
|
//获取当前产品
|
|
|
var currentproduct = _productService.GetCurrentProduct();
|
|
|
- TotalQuantity = await _systemDatabaseService.GetOverallProductionAsync(CurrentProduct.Name);
|
|
|
- TotalQuantityToday = await _systemDatabaseService.GetTodayProductionAsync(CurrentProduct.Name);
|
|
|
- CurrentUPH = await _systemDatabaseService.GetLastHourProductionAsync(CurrentProduct.Name);
|
|
|
+ if (currentproduct == null) return;
|
|
|
+ TotalQuantity = await _systemDatabaseService.GetOverallProductionAsync(currentproduct.Name);
|
|
|
+ TotalQuantityToday = await _systemDatabaseService.GetTodayProductionAsync(currentproduct.Name);
|
|
|
+ CurrentUPH = await _systemDatabaseService.GetLastHourProductionAsync(currentproduct.Name);
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|