徐孝锋 9 ay önce
ebeveyn
işleme
5f75dbc61e

+ 6 - 7
TeamAAS-VM/Controls/PlcRobotManual.xaml

@@ -31,7 +31,8 @@
             </Grid.RowDefinitions>
 
             <Grid Grid.Row="0"
-                  Margin="10" HorizontalAlignment="Center">
+                  Margin="10"
+                  HorizontalAlignment="Center">
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="auto" />
                     <ColumnDefinition Width="auto" />
@@ -237,7 +238,7 @@
                         <TextBlock Text="-W"
                                    HorizontalAlignment="Center" />
                     </StackPanel>
-                </Button>--> 
+                </Button>-->
                 <StackPanel Grid.Row="5"
                             Grid.ColumnSpan="7"
                             Margin="10,10,0,10"
@@ -269,7 +270,7 @@
                     </TextBlock.Text>
                 </TextBlock>
             </Grid>
-            
+
             <!-- 附加轴列表:绑定到视图模型中的 ExtraAxes 集合(每项假定有 Name、Position) -->
             <ItemsControl Grid.Row="1"
                           ItemsSource="{Binding AdditionalAxisList}">
@@ -294,8 +295,7 @@
                                 <StackPanel Orientation="Horizontal"
                                             HorizontalAlignment="Right"
                                             DockPanel.Dock="Right">
-                                    <Button 
-                                            Width="60"
+                                    <Button Width="60"
                                             Height="36"
                                             Margin="6,0"
                                             Style="{StaticResource MaterialDesignRaisedDarkButton}"
@@ -309,8 +309,7 @@
                                                        HorizontalAlignment="Center" />
                                         </StackPanel>
                                     </Button>
-                                    <Button 
-                                            Width="60"
+                                    <Button Width="60"
                                             Height="36"
                                             Margin="6,0"
                                             Style="{StaticResource MaterialDesignRaisedDarkButton}"

+ 22 - 15
TeamAAS-VM/Core/Management.cs

@@ -1077,7 +1077,7 @@ namespace TeamAAS_VP.Core
                             //相机的编号
                             Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.In_DowmCameraNum.Address);
                             SendTaskMessage($"编号:{cameraIndex}", MessageLevel.Info);
-
+                            
                             // 获取机器人当前坐标
                             var robot = _robotService.GetAllRobots().FirstOrDefault();
                             if (robot == null)
@@ -1119,7 +1119,9 @@ namespace TeamAAS_VP.Core
                                     }
                                     else
                                     {
-                                        await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)2);
+                                        //await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)2);
+                                        //return;
+                                        await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)1);
                                         return;
                                     }
                                 }
@@ -1158,7 +1160,9 @@ namespace TeamAAS_VP.Core
                                     }
                                     else
                                     {
-                                        await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)2);
+                                        //await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)2);
+                                        //return;
+                                        await plc.WriteNodeAsync(addressConfig.Out_DownCameraStatus.Address, (Int16)1);
                                         return;
                                     }
 
@@ -1443,6 +1447,7 @@ namespace TeamAAS_VP.Core
                             //相机的编号
                             Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.In_UpCameraPutNum.Address);
                             SendTaskMessage($"编号:{cameraIndex}", MessageLevel.Info);
+                            
 
                             // 获取机器人当前坐标
                             var robot = _robotService.GetAllRobots().FirstOrDefault();
@@ -1515,7 +1520,9 @@ namespace TeamAAS_VP.Core
                                 }
                                 else
                                 {
-                                    await plc.WriteNodeAsync(addressConfig.Out_UpCameraPutStatus.Address, (Int16)2);
+                                    //await plc.WriteNodeAsync(addressConfig.Out_UpCameraPutStatus.Address, (Int16)2);
+                                    //return;
+                                    await plc.WriteNodeAsync(addressConfig.Out_UpCameraPutStatus.Address, (Int16)1);
                                     return;
                                 }
                             }
@@ -1702,17 +1709,17 @@ namespace TeamAAS_VP.Core
                         {
                             SendTaskMessage($"收到多相机坐标合并请求,开始合并...", MessageLevel.Debug);
                             var point = currentProduct.ScrewPoints[0].Clone();
-                            var pn = Vector<double>.Build.Dense(new double[] { UpCameraPutResults[1].X, UpCameraPutResults[1].Y });
-                            //目标角度:
-                            double angle = point.U_Position + (_FixedUpCameraAngle - currentProduct.FixedUpCameraTempletAngle) + (_MoveCameraAngle - currentProduct.MoveDownCamerTempletAngle);
-
-                            var toolCoord = new ToolCoord();
-                            toolCoord.SetTool(DowmCameraResults[1].X, DowmCameraResults[1].Y);
-                            //将_PutPoint转换为Tool0下要走的点
-                            var p0 = toolCoord.GetTool0Coord(pn, angle);
-                            point.X_Position = (float)p0[0];
-                            point.Y_Position = (float)p0[1];
-                            point.U_Position = (float)angle;
+                            //var pn = Vector<double>.Build.Dense(new double[] { UpCameraPutResults[1].X, UpCameraPutResults[1].Y });
+                            ////目标角度:
+                            //double angle = point.U_Position + (_FixedUpCameraAngle - currentProduct.FixedUpCameraTempletAngle) + (_MoveCameraAngle - currentProduct.MoveDownCamerTempletAngle);
+
+                            //var toolCoord = new ToolCoord();
+                            //toolCoord.SetTool(DowmCameraResults[1].X, DowmCameraResults[1].Y);
+                            ////将_PutPoint转换为Tool0下要走的点
+                            //var p0 = toolCoord.GetTool0Coord(pn, angle);
+                            //point.X_Position = (float)p0[0];
+                            //point.Y_Position = (float)p0[1];
+                            //point.U_Position = (float)angle;
                             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);

+ 25 - 0
TeamAAS-VM/Core/Robots/XYZU_Robot.cs

@@ -1131,6 +1131,31 @@ namespace TeamAAS_VP.Core.Robots
             return Task.Run(() => AdditionalAxisJogNeg(axisName, distance));
         }
 
+        /// <summary>
+        /// 获取附加轴的当前坐标
+        /// </summary>
+        /// <param name="axisName"></param>
+        /// <returns></returns>
+        public float GetAdditionalAxisCurrentPos(string axisName)
+        {
+            var axis = AdditionalAxisList.FirstOrDefault(x => x.Name == axisName);
+            if (axis==null)
+            {
+                return 0;
+            }
+            return Plc.ReadNode<float>(axis.State.ActPositionNode);
+        }
+
+        /// <summary>
+        /// 获取附加轴的当前坐标
+        /// </summary>
+        /// <param name="axisName"></param>
+        /// <returns></returns>
+        public Task<float> GetAdditionalAxisCurrentPosAsync(string axisName)
+        {
+            return Task.Run(()=> GetAdditionalAxisCurrentPos(axisName));
+        }
+
         #endregion
 
         #region 收发数据

+ 2 - 0
TeamAAS-VM/Models/PLC/PlcAddressConfig.cs

@@ -771,6 +771,8 @@ namespace TeamAAS_VP.Models.PLC
             Out_CheckCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Feeder";
             Out_CheckCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].ScrewProNum";
 
+            // Out_CheckCamera(附加轴点位)初始化并赋地址,
+
             Out_ScrewTeachNum = Ensure(Out_ScrewTeachNum);
             Out_ScrewTeachNum.Address = "ns=4;s=DB_Communication|FromPC.ScrewTeachNum";
             Out_ScrewTeachNum.DataType = "int16";

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

@@ -336,7 +336,6 @@ namespace TeamAAS_VP.Models
             set { SetProperty(ref _CheckCameraPoints, value); }
         }
 
-
         private bool _IsLoad;
         /// <summary>
         /// 是否已加载

+ 206 - 92
TeamAAS-VM/ViewModels/Product/PlcPointParamsViewModel.cs

@@ -1,4 +1,5 @@
 using Cognex.VisionPro;
+using MahApps.Metro.Controls;
 using MaterialDesignThemes.Wpf;
 using MathNet.Numerics.LinearAlgebra;
 using NPOI.SS.Formula.Functions;
@@ -202,86 +203,6 @@ namespace TeamAAS_VP.ViewModels.Product
             }
         }
 
-        private float _LockPointStartZ;
-        /// <summary>
-        /// 批量设置锁付点的起始Z坐标
-        /// </summary>
-        public float LockPointStartZ
-        {
-            get { return _LockPointStartZ; }
-            set { SetProperty(ref _LockPointStartZ, value); }
-        }
-
-        private float _LockZDepth;
-        /// <summary>
-        /// 批量设置锁付点Z深度
-        /// </summary>
-        public float LockZDepth
-        {
-            get { return _LockZDepth; }
-            set { SetProperty(ref _LockZDepth, value); }
-        }
-
-        private float _LockXSpeed;
-        /// <summary>
-        /// 批量设置锁付点X轴速度
-        /// </summary>
-        public float LockXSpeed
-        {
-            get { return _LockXSpeed; }
-            set { SetProperty(ref _LockXSpeed, value); }
-        }
-
-        private float _LockYSpeed;
-        /// <summary>
-        /// 批量设置锁付点Y轴速度
-        /// </summary>
-        public float LockYSpeed
-        {
-            get { return _LockYSpeed; }
-            set { SetProperty(ref _LockYSpeed, value); }
-        }
-
-        private float _LockZSpeed;
-        /// <summary>
-        /// 批量设置锁付点Z轴速度
-        /// </summary>
-        public float LockZSpeed
-        {
-            get { return _LockZSpeed; }
-            set { SetProperty(ref _LockZSpeed, value); }
-        }
-
-        private float _LockZDescendSpeed;
-        /// <summary>
-        /// 批量设置锁付点Z轴下降速度
-        /// </summary>
-        public float LockZDescendSpeed
-        {
-            get { return _LockZDescendSpeed; }
-            set { SetProperty(ref _LockZDescendSpeed, value); }
-        }
-
-        private Int16 _LockFeederNumber;
-        /// <summary>
-        /// 批量设置锁付点供料器编号
-        /// </summary>
-        public Int16 LockFeederNumber
-        {
-            get { return _LockFeederNumber; }
-            set { SetProperty(ref _LockFeederNumber, value); }
-        }
-
-        private Int16 _LockScrewProgramNumber;
-        /// <summary>
-        /// 批量设置锁付点螺丝程序编号
-        /// </summary>
-        public Int16 LockScrewProgramNumber
-        {
-            get { return _LockScrewProgramNumber; }
-            set { SetProperty(ref _LockScrewProgramNumber, value); }
-        }
-
         private bool _IsGrap;
         public bool IsGrap
         {
@@ -364,6 +285,28 @@ namespace TeamAAS_VP.ViewModels.Product
             get { return _Inhal; }
             set { SetProperty(ref _Inhal, value); }
         }
+
+        private PlcPoint _PickP1 = new PlcPoint();
+        public PlcPoint PickP1
+        {
+            get { return _PickP1; }
+            set { SetProperty(ref _PickP1, value); }
+        }
+
+        private PlcPoint _PickP2 = new PlcPoint();
+        public PlcPoint PickP2
+        {
+            get { return _PickP2; }
+            set { SetProperty(ref _PickP2, value); }
+        }
+
+        private int _ColumnNum = 18;
+        public int ColumnNum
+        {
+            get { return _ColumnNum; }
+            set { SetProperty(ref _ColumnNum, value); }
+        }
+
         #endregion
 
         #region 命令
@@ -471,6 +414,21 @@ namespace TeamAAS_VP.ViewModels.Product
         private DelegateCommand<object> _AdditionalAxisMotorOffCommand;
         public DelegateCommand<object> AdditionalAxisMotorOffCommand =>
             _AdditionalAxisMotorOffCommand ?? (_AdditionalAxisMotorOffCommand = new DelegateCommand<object>(ExecuteAdditionalAxisMotorOffCommand).ObservesCanExecute(() => CanExecute).ObservesProperty(() => Robot).ObservesProperty(() => Robot.CanExecute));
+
+        private DelegateCommand<string> _PickTechCommand;
+        public DelegateCommand<string> PickTechCommand =>
+            _PickTechCommand ?? (_PickTechCommand = new DelegateCommand<string>(ExecutePickTechCommand));
+
+        private DelegateCommand<string> _PickMoveCommand;
+        public DelegateCommand<string> PickMoveCommand =>
+            _PickMoveCommand ?? (_PickMoveCommand = new DelegateCommand<string>(ExecutePickMoveCommand));
+
+        private DelegateCommand _CalPickPosCommand;
+        public DelegateCommand CalPickPosCommand =>
+            _CalPickPosCommand ?? (_CalPickPosCommand = new DelegateCommand(ExecuteCalPickPosCommand));
+
+
+
         #endregion
 
         #region 事件
@@ -689,6 +647,11 @@ namespace TeamAAS_VP.ViewModels.Product
                     _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
                     return;
                 }
+                else if (SelectedIndex == 1)
+                {
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = "当前模式不允许直接示教取料点!", Duration = 1 });
+                    return;
+                }
                 else
                 {
                     //弹窗用户是否确认要示教该点位
@@ -1154,7 +1117,6 @@ namespace TeamAAS_VP.ViewModels.Product
             return SelectedPoint != null;
         }
 
-
         ToolCoord toolCoord = null;
         double _FixedUpCameraTempletAngle = 0;
         double _MoveCameraTempletAngle = 0;
@@ -1548,6 +1510,163 @@ namespace TeamAAS_VP.ViewModels.Product
                 _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
             }
         }
+
+        /// <summary>
+        /// 移动取料托盘点
+        /// </summary>
+        async void ExecutePickMoveCommand(string parameter)
+        {
+            if (Robot == null || !Robot.IsConnected) return;
+            try
+            {
+                //弹窗用户是否确认要示教该点位
+                if (MessageBox.Show($"确认要移动取料点位 {parameter} 吗?", "移动点位", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+                {
+                    return;
+                }
+                int index = int.Parse(parameter);
+                var curpos = await Robot.GetRobotPosAsync();
+                var addpos = await Robot.GetAdditionalAxisCurrentPosAsync(Robot.AdditionalAxisList[0].Name);
+                if (index == 1)
+                {
+                    curpos.Z = 0;
+                    await Robot.CalibMotionAsync(curpos, 0);
+
+                    await Robot.AdditionalAxisMoveAsync(Robot.AdditionalAxisList[0].Name, PickP1.Z_Position_Stop);
+                    curpos.X = PickP1.X_Position;
+                    curpos.Y = PickP1.Y_Position;
+                    curpos.Z = PickP1.Z_Position_Start;
+                    curpos.U = PickP1.U_Position;
+                    await Robot.CalibMotionAsync(curpos, 0);
+                }
+                else if (index == 2)
+                {
+                    curpos.Z = 0;
+                    await Robot.CalibMotionAsync(curpos, 0);
+
+                    await Robot.AdditionalAxisMoveAsync(Robot.AdditionalAxisList[0].Name, PickP2.Z_Position_Stop);
+                    curpos.X = PickP2.X_Position;
+                    curpos.Y = PickP2.Y_Position;
+                    curpos.Z = PickP2.Z_Position_Start;
+                    curpos.U = PickP2.U_Position;
+                    await Robot.CalibMotionAsync(curpos, 0);
+                }
+                _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="parameter"></param>
+        async void ExecutePickTechCommand(string parameter)
+        {
+            if (Robot == null || !Robot.IsConnected) return;
+            try
+            {
+                //弹窗用户是否确认要示教该点位
+                if (MessageBox.Show($"确认要示教取料点位 {parameter} 吗?", "示教点位", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+                {
+                    return;
+                }
+
+                int index = int.Parse(parameter);
+                var curpos = await Robot.GetRobotPosAsync();
+                var addpos = await Robot.GetAdditionalAxisCurrentPosAsync(Robot.AdditionalAxisList[0].Name);
+                if (index == 1)
+                {
+                    PickP1.X_Position = curpos.X;
+                    PickP1.Y_Position = curpos.Y;
+                    PickP1.Z_Position_Start = curpos.Z;
+                    PickP1.U_Position = curpos.U;
+                    PickP1.Z_Position_Stop = addpos;
+                }
+                else if (index == 2)
+                {
+                    PickP2.X_Position = curpos.X;
+                    PickP2.Y_Position = curpos.Y;
+                    PickP2.Z_Position_Start = curpos.Z;
+                    PickP2.U_Position = curpos.U;
+                    PickP2.Z_Position_Stop = addpos;
+                }
+                _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>
+        void ExecuteCalPickPosCommand()
+        {
+            try
+            {
+                if (ColumnNum < 1)
+                {
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"请设置托盘列数!", Duration = 1 });
+                    return;
+                }
+
+                //弹窗用户是否确认要示教该点位
+                if (MessageBox.Show($"确认要计算托盘 吗?", "计算托盘", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+                {
+                    return;
+                }
+
+                //托盘间隔
+                double invt = (PickP2.Z_Position_Stop - PickP1.Z_Position_Stop) / (ColumnNum - 1);
+                for (int i = 0; i < ColumnNum; i++)
+                {
+                    if (Points.Count - 1 <= i)
+                    {
+                        Points[i].Number = i + 1;
+                        Points[i].X_Position = PickP1.X_Position;
+                        Points[i].X_Velocity = 100;
+                        Points[i].Y_Position = PickP1.Y_Position;
+                        Points[i].Y_Velocity = 100;
+                        Points[i].Z_Position_Start = PickP1.Z_Position_Start;
+                        Points[i].Z_Velocity_Start = 100;
+                        Points[i].U_Position = PickP1.U_Position;
+                        Points[i].U_Velocity = 100;
+                        Points[i].Z_Position_Stop = (float)(PickP1.Z_Position_Stop + i * invt);
+                        Points[i].Z_Velocity_Stop = 100;
+                    }
+                    else
+                    {
+                        Points.Add(new PlcPoint()
+                        {
+                            Number= i + 1,
+                            X_Position = PickP1.X_Position,
+                            X_Velocity = 100,
+                            Y_Position = PickP1.Y_Position,
+                            Y_Velocity = 100,
+                            Z_Position_Start = PickP1.Z_Position_Start,
+                            Z_Velocity_Start = 100,
+                            U_Position = PickP1.U_Position,
+                            U_Velocity = 100,
+                            Z_Position_Stop = (float)(PickP1.Z_Position_Stop + i * invt),
+                            Z_Velocity_Stop = 100
+                        });
+                    }
+                }
+                _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 继承
@@ -1600,18 +1719,13 @@ namespace TeamAAS_VP.ViewModels.Product
                         ProcedureModels.Add(item1);
                     }
                 }
-
-                //对锁付点的批量设置进行初始化
-                LockPointStartZ = SelectProduct.ScrewPoints.FirstOrDefault()?.Z_Position_Start ?? 0;
-                LockZDepth = SelectProduct.ScrewPoints.FirstOrDefault() != null ? (SelectProduct.ScrewPoints.FirstOrDefault().Z_Position_Start - SelectProduct.ScrewPoints.FirstOrDefault().Z_Position_Stop) : 0;
-                LockXSpeed = SelectProduct.ScrewPoints.FirstOrDefault()?.X_Velocity ?? 100;
-                LockYSpeed = SelectProduct.ScrewPoints.FirstOrDefault()?.Y_Velocity ?? 100;
-                LockZSpeed = SelectProduct.ScrewPoints.FirstOrDefault()?.Z_Velocity_Start ?? 100;
-                LockZDescendSpeed = SelectProduct.ScrewPoints.FirstOrDefault()?.Z_Velocity_Stop ?? 100;
-                LockFeederNumber = SelectProduct.ScrewPoints.FirstOrDefault()?.Feeder ?? 1;
-                LockScrewProgramNumber = SelectProduct.ScrewPoints.FirstOrDefault()?.ScrewProNum ?? 1;
-
                 CameraList = new ObservableCollection<CameraInfo>(_configService.GetAllCameras());
+                if (SelectProduct.PickPoints!=null && SelectProduct.PickPoints.Count>0)
+                {
+                    PickP1 = SelectProduct.PickPoints.FirstOrDefault().Clone();
+                    PickP2 = SelectProduct.PickPoints.LastOrDefault().Clone();
+                    ColumnNum = SelectProduct.PickPoints.Count;
+                }
             }
             catch (Exception ex)
             {

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

@@ -205,7 +205,6 @@ namespace TeamAAS_VP.ViewModels.Product
                         ScrewCameraPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
                         ScrewPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
                         CheckCameraPoints=new ObservableCollection<Models.PLC.PlcPoint>(),
-
                     };
 
                     var cameras = _configService.GetAllCameras();

+ 2 - 5
TeamAAS-VM/Views/DebugMod/PlcRobotManualStep.xaml

@@ -300,7 +300,6 @@
                                                VerticalAlignment="Center" />
                                     <TextBlock Text="{Binding CurrentPosition, StringFormat='{}{0:F3} mm'}"
                                                Width="140"
-                                               
                                                VerticalAlignment="Center" />
                                 </StackPanel>
                                 <StackPanel Orientation="Horizontal"
@@ -327,8 +326,7 @@
                                                     Value="10" />
                                         </Style>
                                     </StackPanel.Resources>
-                                    <Button
-                                            Width="60"
+                                    <Button Width="60"
                                             Height="36"
                                             Margin="6,0"
                                             Style="{StaticResource MaterialDesignRaisedDarkButton}"
@@ -342,8 +340,7 @@
                                                        HorizontalAlignment="Center" />
                                         </StackPanel>
                                     </Button>
-                                    <Button 
-                                            Width="60"
+                                    <Button Width="60"
                                             Height="36"
                                             Margin="6,0"
                                             Style="{StaticResource MaterialDesignRaisedDarkButton}"

+ 164 - 61
TeamAAS-VM/Views/Product/PlcPointParams.xaml

@@ -118,8 +118,7 @@
                                 Orientation="Horizontal">
                         <TextBlock Text="{lex:Loc 相机,Converter={StaticResource StringFormatConverter},ConverterParameter='{}{0}: '}"
                                    FontWeight="Bold"
-                                   VerticalAlignment="Center"
-                                   />
+                                   VerticalAlignment="Center" />
                         <ComboBox Margin="5,0,10,0"
                                   IsEnabled="{Binding IsGrap,Converter={StaticResource InvertBooleanConverter}}"
                                   ItemsSource="{Binding CameraList}"
@@ -155,7 +154,7 @@
                                    Foreground="Gray" />
                     </StackPanel>
                 </Grid>
-                
+
             </materialDesign:DrawerHost.LeftDrawerContent>
             <Grid>
                 <Grid.ColumnDefinitions>
@@ -320,7 +319,9 @@
                                         <Setter Property="Visibility"
                                                 Value="Collapsed" />
                                         <Style.Triggers>
-                                            --><!-- 当 SelectedIndex == 0 时显示此面板 --><!--
+                                            -->
+                            <!-- 当 SelectedIndex == 0 时显示此面板 -->
+                            <!--
                                             <DataTrigger Binding="{Binding SelectedIndex}"
                                                          Value="4">
                                                 <Setter Property="Visibility"
@@ -360,23 +361,140 @@
                                     </StackPanel.Style>
                                     <ScrollViewer HorizontalScrollBarVisibility="Auto"
                                                   VerticalScrollBarVisibility="Disabled">
-                                        <StackPanel Orientation="Horizontal"
-                                                    HorizontalAlignment="Left"
-                                                    >
-                                            <TextBlock Text="吸真空编号:"
-                                                       VerticalAlignment="Center" />
-                                            <mah:NumericUpDown MinWidth="100"
-                                                               HorizontalContentAlignment="Center"
-                                                               VerticalContentAlignment="Center"
-                                                               Minimum="0"
-                                                               Maximum="100"
-                                                               Value="{Binding Inhal,Mode=OneWay}"
-                                                               Margin="5,0,0,0" />
 
-                                            <Button Content="执行取料"
-                                                    Margin="10,0,0,0"
-                                                    materialDesign:ButtonAssist.CornerRadius="5"
-                                                    Command="{Binding GoPickCommand}" />
+                                        <StackPanel Orientation="Vertical"
+                                                    HorizontalAlignment="Left">
+                                            <Grid>
+                                                <Grid.RowDefinitions>
+                                                    <RowDefinition Height="auto" />
+                                                    <RowDefinition Height="auto" />
+                                                    <RowDefinition Height="auto" />
+                                                    <RowDefinition Height="auto" />
+                                                </Grid.RowDefinitions>
+                                                <Grid.ColumnDefinitions>
+                                                    <ColumnDefinition Width="auto" />
+                                                    <ColumnDefinition Width="auto" />
+                                                    <ColumnDefinition Width="auto" />
+                                                    <ColumnDefinition Width="auto" />
+                                                    <ColumnDefinition Width="auto" />
+                                                    <ColumnDefinition Width="auto" />
+                                                    <ColumnDefinition Width="auto" />
+                                                    <ColumnDefinition Width="auto" />
+                                                </Grid.ColumnDefinitions>
+                                                <Grid.Resources>
+                                                    <Style TargetType="TextBlock">
+                                                        <Setter Property="HorizontalAlignment"
+                                                                Value="Center" />
+                                                        <Setter Property="VerticalAlignment"
+                                                                Value="Center" />
+                                                    </Style>
+                                                    <Style TargetType="TextBox">
+                                                        <Setter Property="HorizontalAlignment"
+                                                                Value="Center" />
+                                                        <Setter Property="VerticalAlignment"
+                                                                Value="Center" />
+                                                        <Setter Property="MinWidth"
+                                                                Value="50" />
+                                                    </Style>
+                                                </Grid.Resources>
+                                                <TextBlock Text="X"
+                                                           Grid.Column="1" />
+                                                <TextBlock Text="Y"
+                                                           Grid.Column="2" />
+                                                <TextBlock Text="Z"
+                                                           Grid.Column="3" />
+                                                <TextBlock Text="U"
+                                                           Grid.Column="4" />
+                                                <TextBlock Text="附加轴"
+                                                           Grid.Column="5" />
+                                                <TextBlock Text="点1:"
+                                                           Grid.Row="1"
+                                                           Grid.Column="0" />
+                                                <TextBlock Text="点2:"
+                                                           Grid.Row="2"
+                                                           Grid.Column="0" />
+                                                <TextBox Text="{Binding PickP1.X_Position}"
+                                                         Grid.Row="1"
+                                                         Grid.Column="1" />
+                                                <TextBox Text="{Binding PickP1.Y_Position}"
+                                                         Grid.Row="1"
+                                                         Grid.Column="2" />
+                                                <TextBox Text="{Binding PickP1.Z_Position_Start}"
+                                                         Grid.Row="1"
+                                                         Grid.Column="3" />
+                                                <TextBox Text="{Binding PickP1.U_Position}"
+                                                         Grid.Row="1"
+                                                         Grid.Column="4" />
+                                                <TextBox Text="{Binding PickP1.Z_Position_Stop}"
+                                                         Grid.Row="1"
+                                                         Grid.Column="5" />
+                                                <Button Content="示教"
+                                                        Grid.Row="1"
+                                                        Grid.Column="6"
+                                                        Margin="5,0"
+                                                        Command="{Binding PickTechCommand}"
+                                                        CommandParameter="1" />
+                                                <Button Content="移动"
+                                                        Grid.Row="1"
+                                                        Grid.Column="7"
+                                                        Command="{Binding PickMoveCommand}"
+                                                        CommandParameter="1" />
+                                                <TextBox Text="{Binding PickP2.X_Position}"
+                                                         Grid.Row="2"
+                                                         Grid.Column="1" />
+                                                <TextBox Text="{Binding PickP2.Y_Position}"
+                                                         Grid.Row="2"
+                                                         Grid.Column="2" />
+                                                <TextBox Text="{Binding PickP2.Z_Position_Start}"
+                                                         Grid.Row="2"
+                                                         Grid.Column="3" />
+                                                <TextBox Text="{Binding PickP2.U_Position}"
+                                                         Grid.Row="2"
+                                                         Grid.Column="4" />
+                                                <TextBox Text="{Binding PickP2.Z_Position_Stop}"
+                                                         Grid.Row="2"
+                                                         Grid.Column="5" />
+                                                <Button Content="示教"
+                                                        Grid.Row="2"
+                                                        Grid.Column="6"
+                                                        Margin="5,0"
+                                                        Command="{Binding PickTechCommand}"
+                                                        CommandParameter="2" />
+                                                <Button Content="移动"
+                                                        Grid.Row="2"
+                                                        Grid.Column="7"
+                                                        Command="{Binding PickMoveCommand}"
+                                                        CommandParameter="2" />
+                                                <TextBlock Text="列数:"
+                                                           Grid.Row="3"
+                                                           Grid.Column="0" />
+                                                <TextBox Text="{Binding ColumnNum}"
+                                                         Grid.Row="3"
+                                                         Grid.Column="1" />
+                                                <Button Content="计算取料点"
+                                                        Grid.Row="3"
+                                                        Grid.ColumnSpan="4"
+                                                        Margin="5,0"
+                                                        HorizontalAlignment="Left"
+                                                        Grid.Column="2"
+                                                        Command="{Binding CalPickPosCommand}" />
+                                            </Grid>
+                                            <StackPanel Orientation="Horizontal">
+                                                <TextBlock Text="吸真空编号:"
+                                                           VerticalAlignment="Center" />
+                                                <mah:NumericUpDown MinWidth="100"
+                                                                   HorizontalContentAlignment="Center"
+                                                                   VerticalContentAlignment="Center"
+                                                                   Minimum="0"
+                                                                   Maximum="100"
+                                                                   Value="{Binding Inhal,Mode=OneWay}"
+                                                                   Margin="5,0,0,0" />
+
+                                                <Button Content="执行取料"
+                                                        Margin="10,0,0,0"
+                                                        materialDesign:ButtonAssist.CornerRadius="5"
+                                                        Command="{Binding GoPickCommand}" />
+                                            </StackPanel>
                                         </StackPanel>
                                     </ScrollViewer>
                                 </StackPanel>
@@ -406,14 +524,12 @@
                                             <Button Content="执行二次定位"
                                                     Margin="10,0,0,0"
                                                     materialDesign:ButtonAssist.CornerRadius="5"
-                                                    Command="{Binding GoRepositionCommand}"
-                                                    />
+                                                    Command="{Binding GoRepositionCommand}" />
                                         </StackPanel>
                                     </ScrollViewer>
                                 </StackPanel>
                                 <!--产品拍照-->
-                                <StackPanel 
-                                            Orientation="Vertical"
+                                <StackPanel Orientation="Vertical"
                                             d:Visibility="Visible">
                                     <StackPanel.Style>
                                         <Style TargetType="StackPanel">
@@ -440,34 +556,6 @@
                                         </StackPanel>
                                     </ScrollViewer>
                                 </StackPanel>
-                                <!--产品贴敷-->
-                                <StackPanel Orientation="Vertical"
-                                            d:Visibility="Visible">
-                                    <StackPanel.Style>
-                                        <Style TargetType="StackPanel">
-                                            <Setter Property="Visibility"
-                                                    Value="Collapsed" />
-                                            <Style.Triggers>
-                                                <!--当 SelectedIndex == 4 时显示此面板-->
-                                                <DataTrigger Binding="{Binding SelectedIndex}"
-                                                             Value="4">
-                                                    <Setter Property="Visibility"
-                                                            Value="Visible" />
-                                                </DataTrigger>
-                                            </Style.Triggers>
-                                        </Style>
-                                    </StackPanel.Style>
-                                    <ScrollViewer HorizontalScrollBarVisibility="Auto"
-                                                  VerticalScrollBarVisibility="Disabled">
-                                        <StackPanel Orientation="Horizontal"
-                                                    HorizontalAlignment="Left">
-                                            <Button Content="执行产品贴敷"
-                                                    Margin="10,0,0,0"
-                                                    materialDesign:ButtonAssist.CornerRadius="5"
-                                                    Command="{Binding TakeProductCommand}" />
-                                        </StackPanel>
-                                    </ScrollViewer>
-                                </StackPanel>
 
 
                             </StackPanel>
@@ -929,7 +1017,7 @@
 
                     <!--运动控制区-->
                     <Viewbox Grid.Column="1">
-                        <Grid >
+                        <Grid>
                             <Grid.RowDefinitions>
                                 <RowDefinition Height="auto" />
                                 <RowDefinition Height="auto" />
@@ -940,7 +1028,7 @@
                             <ToggleButton Grid.ColumnSpan="2"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Top"
-                                         materialDesign:ToggleButtonAssist.OnContent="{materialDesign:PackIcon Kind=ArrowLeft}"
+                                          materialDesign:ToggleButtonAssist.OnContent="{materialDesign:PackIcon Kind=ArrowLeft}"
                                           Content="{materialDesign:PackIcon Kind=Camera}"
                                           Style="{StaticResource MaterialDesignActionToggleButton}"
                                           ToolTip="相机图像"
@@ -991,7 +1079,8 @@
                                             Grid.Row="0"
                                             Grid.Column="0"
                                             VerticalAlignment="Center"
-                                            Orientation="Horizontal" Margin="30,0,0,0">
+                                            Orientation="Horizontal"
+                                            Margin="30,0,0,0">
                                     <Button Content="{lex:Loc 上使能}"
                                             Grid.Row="2"
                                             materialDesign:ButtonAssist.CornerRadius="10"
@@ -1239,20 +1328,34 @@
                                                 <StackPanel Orientation="Horizontal"
                                                             HorizontalAlignment="Right"
                                                             DockPanel.Dock="Right">
-                                                    <Button Content="-"
-                                                            Width="60"
+                                                    <Button Width="60"
                                                             Height="36"
                                                             Margin="6,0"
                                                             Style="{StaticResource MaterialDesignRaisedDarkButton}"
                                                             Command="{Binding DataContext.AdditionalAxisJogPlusCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
-                                                            CommandParameter="{Binding}" />
-                                                    <Button Content="+"
-                                                            Width="60"
+                                                            CommandParameter="{Binding}">
+                                                        <StackPanel Orientation="Vertical">
+                                                            <materialDesign:PackIcon Kind="ArrowLeftBold"
+                                                                                     Width="26"
+                                                                                     Height="26" />
+                                                            <TextBlock Text="+"
+                                                                       HorizontalAlignment="Center" />
+                                                        </StackPanel>
+                                                    </Button>
+                                                    <Button Width="60"
                                                             Height="36"
                                                             Margin="6,0"
                                                             Style="{StaticResource MaterialDesignRaisedDarkButton}"
                                                             Command="{Binding DataContext.AdditionalAxisJogMinusCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
-                                                            CommandParameter="{Binding}" />
+                                                            CommandParameter="{Binding}">
+                                                        <StackPanel Orientation="Vertical">
+                                                            <materialDesign:PackIcon Kind="ArrowRightBold"
+                                                                                     Width="26"
+                                                                                     Height="26" />
+                                                            <TextBlock Text="-"
+                                                                       HorizontalAlignment="Center" />
+                                                        </StackPanel>
+                                                    </Button>
                                                     <Button Content="上使能"
                                                             Width="60"
                                                             Height="36"