徐孝锋 8 meses atrás
pai
commit
1bf1a5f671

+ 6 - 0
TeamAAS-VM/Models/Product/ProductModel.cs

@@ -324,6 +324,12 @@ namespace TeamAAS_VP.Models
                 Power = this.Power,
                 IsUserUpCamera = this.IsUserUpCamera,
                 GlobalParamListCollection = new ObservableCollection<ProductGlobalParam>(this.GlobalParamListCollection.Select(gp => gp.Copy())),
+                PickCameraPoints = this.PickCameraPoints,
+                PickPoints = this.PickPoints,
+                SecPosCameraPoints = this.SecPosCameraPoints,
+                ScrewCameraPoints = this.ScrewCameraPoints,
+                ScrewPoints = this.ScrewPoints,
+                CheckCameraPoints = this.CheckCameraPoints,
                 IsLoad = this.IsLoad,
                 IsCreate = this.IsCreate
             };

+ 20 - 25
TeamAAS-VM/ViewModels/Product/PlcPointParamsViewModel.cs

@@ -169,9 +169,9 @@ namespace TeamAAS_VP.ViewModels.Product
         public DelegateCommand<object> JogCommand =>
             _JogCommand ?? (_JogCommand = new DelegateCommand<object>(ExecuteJogCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
 
-        private DelegateCommand<RPoint> _TechPointCommand;
-        public DelegateCommand<RPoint> TechPointCommand =>
-            _TechPointCommand ?? (_TechPointCommand = new DelegateCommand<RPoint>(ExecuteTechPointCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
+        private DelegateCommand _TechPointCommand;
+        public DelegateCommand TechPointCommand =>
+            _TechPointCommand ?? (_TechPointCommand = new DelegateCommand(ExecuteTechPointCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
 
         private DelegateCommand<string> _MotorCommand;
         public DelegateCommand<string> MotorCommand =>
@@ -351,29 +351,24 @@ namespace TeamAAS_VP.ViewModels.Product
         /// 示教点位
         /// </summary>
         /// <param name="point"></param>
-        async void ExecuteTechPointCommand(RPoint point)
+        async void ExecuteTechPointCommand()
         {
-            //if (Robot == null || !Robot.IsConnected) return;
-            //try
-            //{
-            //    var curpos = await Robot.GetRobotPosAsync();
-            //    var p0 = SelectedRobot.Points.FirstOrDefault(x => x.Number == point.Number);
-            //    p0.X = curpos.X;
-            //    p0.Y = curpos.Y;
-            //    p0.Z = curpos.Z;
-            //    p0.U = curpos.U;
-            //    p0.V = curpos.V;
-            //    p0.W = curpos.W;
-            //    p0.Hand = curpos.Hand;
-            //    p0.Local = curpos.Local;
-            //    p0.Tool = curpos.Tool;
-            //    _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 });
-            //}
+            if (Robot == null || !Robot.IsConnected) return;
+            try
+            {
+                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)
+            {
+                LogHelper.WriteLogError("机器人点位-示教点位时出错", ex);
+                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+            }
         }
 
         void ExecuteLoadedCommand()

+ 8 - 0
TeamAAS-VM/ViewModels/Product/ProductHomeViewModel.cs

@@ -199,7 +199,15 @@ namespace TeamAAS_VP.ViewModels.Product
                         Power = false,
                         IsUserUpCamera = false,
                         GlobalParamListCollection = new ObservableCollection<ProductGlobalParam>(),
+                        PickCameraPoints = new ObservableCollection<Models.PLC.PlcPoint>(),
+                        PickPoints = new ObservableCollection<Models.PLC.PlcPoint>(),
+                        SecPosCameraPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
+                        ScrewCameraPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
+                        ScrewPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
+                        CheckCameraPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
+
                     };
+
                     var cameras = _configService.GetAllCameras();
                     foreach (var item in cameras)
                     {

+ 3 - 3
TeamAAS-VM/Views/Product/PlcPointParams.xaml

@@ -224,11 +224,11 @@
                         
                         <StackPanel DockPanel.Dock="Bottom"
                                     Orientation="Horizontal">
-                            <Button Content="{lex:Loc 添加点}"
+                            <Button Content="添加点"
                                     Margin="5,2"
                                     MinWidth="80"
                                     Command="{Binding AddPointCommand}" />
-                            <Button Content="{lex:Loc 删除点}"
+                            <Button Content="删除点"
                                     Margin="5,2"
                                     MinWidth="80"
                                     Command="{Binding DeletePointCommand}" />
@@ -986,7 +986,7 @@
                                             Margin="10"
                                             HorizontalAlignment="Right"
                                             Command="{Binding DataContext.TechPointCommand,RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
-                                            CommandParameter="{Binding ElementName=cmbSelectPoint,Path=SelectedItem}" />
+                                             />
                                     <!--<ToggleButton Grid.Row="3"
                                                   Grid.Column="2"
                                                   HorizontalAlignment="Right"