徐孝锋 8 달 전
부모
커밋
84bed9dec9
1개의 변경된 파일121개의 추가작업 그리고 123개의 파일을 삭제
  1. 121 123
      TeamAAS-VM/ViewModels/Product/PlcPointParamsViewModel.cs

+ 121 - 123
TeamAAS-VM/ViewModels/Product/PlcPointParamsViewModel.cs

@@ -438,24 +438,6 @@ namespace TeamAAS_VP.ViewModels.Product
         public DelegateCommand StopGrabbingCommand =>
             _StopGrabbingCommand ?? (_StopGrabbingCommand = new DelegateCommand(ExecuteStopGrabbingCommand, CanExecuteStopGrabbingCommand).ObservesProperty(() => IsGrap).ObservesProperty(() => SelectedCamera));
 
-        //附加轴,轴点动+命令
-        private DelegateCommand<object> _AdditionalAxisJogPlusCommand;
-        public DelegateCommand<object> AdditionalAxisJogPlusCommand =>
-            _AdditionalAxisJogPlusCommand ?? (_AdditionalAxisJogPlusCommand = new DelegateCommand<object>(ExecuteAdditionalAxisJogPlusCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
-
-        //附加轴,轴点动-命令
-        private DelegateCommand<object> _AdditionalAxisJogMinusCommand;
-        public DelegateCommand<object> AdditionalAxisJogMinusCommand =>
-            _AdditionalAxisJogMinusCommand ?? (_AdditionalAxisJogMinusCommand = new DelegateCommand<object>(ExecuteAdditionalAxisJogMinusCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
-
-        private DelegateCommand<object> _AdditionalAxisMotorOnCommand;
-        public DelegateCommand<object> AdditionalAxisMotorOnCommand =>
-            _AdditionalAxisMotorOnCommand ?? (_AdditionalAxisMotorOnCommand = new DelegateCommand<object>(ExecuteAdditionalAxisMotorOnCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
-
-        private DelegateCommand<object> _AdditionalAxisMotorOffCommand;
-        public DelegateCommand<object> AdditionalAxisMotorOffCommand =>
-            _AdditionalAxisMotorOffCommand ?? (_AdditionalAxisMotorOffCommand = new DelegateCommand<object>(ExecuteAdditionalAxisMotorOffCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
-
         private DelegateCommand _GoPickCommand;
         public DelegateCommand GoPickCommand =>
             _GoPickCommand ?? (_GoPickCommand = new DelegateCommand(ExecuteGoPickCommand, CanExecuteCommandGoPickCommandName).ObservesProperty(() => SelectedPoint));
@@ -472,7 +454,23 @@ namespace TeamAAS_VP.ViewModels.Product
         public DelegateCommand TakeProductCommand =>
             _TakeProductCommand ?? (_TakeProductCommand = new DelegateCommand(ExecuteTakeProductCommand, CanExecuteCommandGoPickCommandName).ObservesProperty(() => SelectedPoint));
 
+        //附加轴,轴点动+命令
+        private DelegateCommand<object> _AdditionalAxisJogPlusCommand;
+        public DelegateCommand<object> AdditionalAxisJogPlusCommand =>
+            _AdditionalAxisJogPlusCommand ?? (_AdditionalAxisJogPlusCommand = new DelegateCommand<object>(ExecuteAdditionalAxisJogPlusCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
+
+        //附加轴,轴点动-命令
+        private DelegateCommand<object> _AdditionalAxisJogMinusCommand;
+        public DelegateCommand<object> AdditionalAxisJogMinusCommand =>
+            _AdditionalAxisJogMinusCommand ?? (_AdditionalAxisJogMinusCommand = new DelegateCommand<object>(ExecuteAdditionalAxisJogMinusCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
+
+        private DelegateCommand<object> _AdditionalAxisMotorOnCommand;
+        public DelegateCommand<object> AdditionalAxisMotorOnCommand =>
+            _AdditionalAxisMotorOnCommand ?? (_AdditionalAxisMotorOnCommand = new DelegateCommand<object>(ExecuteAdditionalAxisMotorOnCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
 
+        private DelegateCommand<object> _AdditionalAxisMotorOffCommand;
+        public DelegateCommand<object> AdditionalAxisMotorOffCommand =>
+            _AdditionalAxisMotorOffCommand ?? (_AdditionalAxisMotorOffCommand = new DelegateCommand<object>(ExecuteAdditionalAxisMotorOffCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
         #endregion
 
         #region 事件
@@ -1091,110 +1089,6 @@ namespace TeamAAS_VP.ViewModels.Product
                  }));
         }
 
-        /// <summary>
-        /// 附加轴+点动
-        /// </summary>
-        /// <param name="obj"></param>
-        async void ExecuteAdditionalAxisJogPlusCommand(object obj)
-        {
-            if (Robot == null || !Robot.IsConnected) return;
-            try
-            {
-                if (obj is AxisExtended axis)
-                {
-                    //如果移动距离大于10mm,则提示用户确认
-                    if (Math.Abs(Distance) >= 10)
-                    {
-                        if (MessageBox.Show($"确认要点动距离 {Distance} mm 吗?", "确认点动", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
-                        {
-                            return;
-                        }
-                    }
-                    await Robot.AdditionalAxisJogAsync(axis.Name, Distance);
-                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
-                }
-            }
-            catch (Exception ex)
-            {
-                LogHelper.WriteLogError("附加轴点动+时出错!", ex);
-                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 0.4 });
-            }
-        }
-
-        /// <summary>
-        /// 附加轴-点动
-        /// </summary>
-        /// <param name="obj"></param>
-        async void ExecuteAdditionalAxisJogMinusCommand(object obj)
-        {
-            if (Robot == null || !Robot.IsConnected) return;
-            try
-            {
-                if (obj is AxisExtended axis)
-                {
-                    //如果移动距离大于10mm,则提示用户确认
-                    if (Math.Abs(Distance) >= 10)
-                    {
-                        if (MessageBox.Show($"确认要点动距离 {Distance} mm 吗?", "确认点动", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
-                        {
-                            return;
-                        }
-                    }
-                    await Robot.AdditionalAxisJogNegAsync(axis.Name, Distance);
-                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
-                }
-            }
-            catch (Exception ex)
-            {
-                LogHelper.WriteLogError("附加轴点动-时出错!", ex);
-                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 0.4 });
-            }
-        }
-
-        /// <summary>
-        /// 附加轴上使能
-        /// </summary>
-        /// <param name="obj"></param>
-        async void ExecuteAdditionalAxisMotorOffCommand(object obj)
-        {
-            if (Robot == null || !Robot.IsConnected) return;
-            try
-            {
-                if (obj is AxisExtended axis)
-                {
-                    await Robot.AdditionalAxisMotorAsync(axis.Name, true);
-                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
-                }
-            }
-            catch (Exception ex)
-            {
-                LogHelper.WriteLogError("附加轴上使能时出错!", ex);
-                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 0.4 });
-            }
-        }
-
-        /// <summary>
-        /// 附加轴下使能
-        /// </summary>
-        /// <param name="obj"></param>
-        async void ExecuteAdditionalAxisMotorOnCommand(object obj)
-        {
-            if (Robot == null || !Robot.IsConnected) return;
-            try
-            {
-                if (obj is AxisExtended axis)
-                {
-                    await Robot.AdditionalAxisMotorAsync(axis.Name, true);
-                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
-                }
-            }
-            catch (Exception ex)
-            {
-                LogHelper.WriteLogError("附加轴下使能时出错!", ex);
-                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 0.4 });
-            }
-        }
-
         /// <summary>
         /// 去取料
         /// </summary>
@@ -1550,6 +1444,110 @@ namespace TeamAAS_VP.ViewModels.Product
                 }
             }
         }
+
+        /// <summary>
+        /// 附加轴+点动
+        /// </summary>
+        /// <param name="obj"></param>
+        async void ExecuteAdditionalAxisJogPlusCommand(object obj)
+        {
+            if (Robot == null || !Robot.IsConnected) return;
+            try
+            {
+                if (obj is AxisExtended axis)
+                {
+                    //如果移动距离大于10mm,则提示用户确认
+                    if (Math.Abs(Distance) >= 10)
+                    {
+                        if (MessageBox.Show($"确认要点动距离 {Distance} mm 吗?", "确认点动", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+                        {
+                            return;
+                        }
+                    }
+                    await Robot.AdditionalAxisJogAsync(axis.Name, Distance);
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                }
+            }
+            catch (Exception ex)
+            {
+                LogHelper.WriteLogError("附加轴点动+时出错!", ex);
+                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+            }
+        }
+
+        /// <summary>
+        /// 附加轴-点动
+        /// </summary>
+        /// <param name="obj"></param>
+        async void ExecuteAdditionalAxisJogMinusCommand(object obj)
+        {
+            if (Robot == null || !Robot.IsConnected) return;
+            try
+            {
+                if (obj is AxisExtended axis)
+                {
+                    //如果移动距离大于10mm,则提示用户确认
+                    if (Math.Abs(Distance) >= 10)
+                    {
+                        if (MessageBox.Show($"确认要点动距离 {Distance} mm 吗?", "确认点动", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+                        {
+                            return;
+                        }
+                    }
+                    await Robot.AdditionalAxisJogNegAsync(axis.Name, Distance);
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                }
+            }
+            catch (Exception ex)
+            {
+                LogHelper.WriteLogError("附加轴点动-时出错!", ex);
+                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+            }
+        }
+
+        /// <summary>
+        /// 附加轴下使能
+        /// </summary>
+        /// <param name="obj"></param>
+        async void ExecuteAdditionalAxisMotorOffCommand(object obj)
+        {
+            if (Robot == null || !Robot.IsConnected) return;
+            try
+            {
+                if (obj is AxisExtended axis)
+                {
+                    await Robot.AdditionalAxisMotorAsync(axis.Name, false);
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                }
+            }
+            catch (Exception ex)
+            {
+                LogHelper.WriteLogError("附加轴上使能时出错!", ex);
+                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+            }
+        }
+
+        /// <summary>
+        /// 附加轴上使能
+        /// </summary>
+        /// <param name="obj"></param>
+        async void ExecuteAdditionalAxisMotorOnCommand(object obj)
+        {
+            if (Robot == null || !Robot.IsConnected) return;
+            try
+            {
+                if (obj is AxisExtended axis)
+                {
+                    await Robot.AdditionalAxisMotorAsync(axis.Name, true);
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                }
+            }
+            catch (Exception ex)
+            {
+                LogHelper.WriteLogError("附加轴下使能时出错!", ex);
+                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+            }
+        }
         #endregion
 
         #region 继承
@@ -1588,6 +1586,7 @@ namespace TeamAAS_VP.ViewModels.Product
                 {
                     this.Distance = _configService.GetRobotStepDistance(Robot.Id);
                     Robot.EnterDebugMode = true;
+                    AdditionalAxisList = Robot.AdditionalAxisList;
                 }
                 else if (Robot != null)
                 {
@@ -1613,7 +1612,6 @@ namespace TeamAAS_VP.ViewModels.Product
                 LockScrewProgramNumber = SelectProduct.ScrewPoints.FirstOrDefault()?.ScrewProNum ?? 1;
 
                 CameraList = new ObservableCollection<CameraInfo>(_configService.GetAllCameras());
-
             }
             catch (Exception ex)
             {