|
|
@@ -43,7 +43,7 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
ISystemDatabaseService _systemDatabaseService;
|
|
|
IRemoteCommandService _remoteCommandService;
|
|
|
ICalibrationService _calibrationService;
|
|
|
- CoordinateTransformer local;
|
|
|
+ CoordinateTransformer local=null;
|
|
|
|
|
|
#region 属性
|
|
|
|
|
|
@@ -561,23 +561,46 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
//如果当前的选项卡处于锁付点位,则提示用户当前模式不允许进行示教
|
|
|
if (SelectedIndex == 4)
|
|
|
{
|
|
|
- MessageBox.Show("当前处于锁付点位模式,不允许进行示教操作!", "示教点位", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
|
- return;
|
|
|
- }
|
|
|
+ //如果local为空,则必须先通过相机定位产品,否则无法示教锁付点位
|
|
|
+ if (local == null)
|
|
|
+ {
|
|
|
+ _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = "当前模式不允许直接示教锁付点位,请先通过相机定位产品!", Duration = 1 });
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- //弹窗用户是否确认要示教该点位
|
|
|
- if (MessageBox.Show($"确认要示教点位 {SelectedPoint.Number} 吗?", "示教点位", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
|
|
|
- {
|
|
|
+ //弹窗用户是否确认要示教该点位
|
|
|
+ if (MessageBox.Show($"确认要示教点位 {SelectedPoint.Number} 吗?", "示教点位", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var curpos1 = await Robot.GetRobotPosAsync();
|
|
|
+ //将当前点位转换为产品Local坐标系下的点位
|
|
|
+ var localPoint = local.ToOldCoord(curpos1.X, curpos1.Y);
|
|
|
+ SelectedPoint.X_Position = (float)localPoint[0];
|
|
|
+ SelectedPoint.Y_Position = (float)localPoint[1];
|
|
|
+ SelectedPoint.Z_Position_Start = curpos1.Z;
|
|
|
+ SelectedPoint.U_Position = curpos1.U;
|
|
|
+ SelectedPoint.R_Position = curpos1.V;
|
|
|
+ _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
|
|
|
return;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //弹窗用户是否确认要示教该点位
|
|
|
+ if (MessageBox.Show($"确认要示教点位 {SelectedPoint.Number} 吗?", "示教点位", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- var curpos = await Robot.GetRobotPosAsync();
|
|
|
- SelectedPoint.X_Position = curpos.X;
|
|
|
- SelectedPoint.Y_Position = curpos.Y;
|
|
|
- SelectedPoint.Z_Position_Start = curpos.Z;
|
|
|
- SelectedPoint.U_Position = curpos.U;
|
|
|
- SelectedPoint.R_Position = curpos.V;
|
|
|
- _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
|
|
|
+ var curpos = await Robot.GetRobotPosAsync();
|
|
|
+ SelectedPoint.X_Position = curpos.X;
|
|
|
+ SelectedPoint.Y_Position = curpos.Y;
|
|
|
+ SelectedPoint.Z_Position_Start = curpos.Z;
|
|
|
+ SelectedPoint.U_Position = curpos.U;
|
|
|
+ SelectedPoint.R_Position = curpos.V;
|
|
|
+ _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
@@ -1127,6 +1150,11 @@ namespace TeamAAS_VP.ViewModels.Product
|
|
|
if (result1 == ButtonResult.OK)
|
|
|
{
|
|
|
var param = rst.Parameters.GetValue<ObservableCollection<PointEx>>("CorrectPoints");
|
|
|
+ var local1= rst.Parameters.GetValue<CoordinateTransformer>("Local");
|
|
|
+ if (local1!=null)
|
|
|
+ {
|
|
|
+ local = local1;
|
|
|
+ }
|
|
|
for (int i = 0; i < SelectProduct.ScrewPoints.Count; i++)
|
|
|
{
|
|
|
SelectProduct.ScrewPoints[i].X_Position = param[i].PostX;
|