Quellcode durchsuchen

完善坐标换算

肖奇伟 vor 2 Tagen
Ursprung
Commit
7e201ef336

BIN
Lib/SCADA_DAQ.Plugin.Robot.dll


BIN
Lib/SCADA_DAQ.Plugin.RobotUI.dll


+ 47 - 59
SCADA_DAQ/Customer/Machines/SampleMachine.cs

@@ -9,6 +9,7 @@ using SCADA_DAQ.Plugin.Core.Service;
 using SCADA_DAQ.Plugin.Machine.Device;
 using SCADA_DAQ.Plugin.Robot.Stacking;
 using System;
+using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
 using System.Linq;
@@ -59,47 +60,20 @@ namespace SCADA_DAQ.Customer.Machines
         /// </summary>
         public event EventHandler<StackStartEventArgs> StackStarted;
 
+        /// <summary>
+        /// 
+        /// </summary>
         public event EventHandler<StackFinishEventArgs> StackFinished;
 
-        ///// <summary>
-        ///// X轴取料点
-        ///// </summary>
-        //private double XReclaimPoint { get; set; }
-
-        ///// <summary>
-        ///// Y轴取料点
-        ///// </summary>
-        //private double YReclaimPoint { get; set; }
-
-        ///// <summary>
-        ///// Z轴取料点
-        ///// </summary>
-        //private double ZReclaimPoint { get; set; }
-
-        ///// <summary>
-        ///// R轴取料点
-        ///// </summary>
-        //private double RReclaimPoint { get; set; }
-
-        ///// <summary>
-        ///// X轴放料点
-        ///// </summary>
-        //private double XDischargePoint { get; set; }
-
-        ///// <summary>
-        ///// Y轴放料点
-        ///// </summary>
-        //private double YDischargePoint { get; set; }
-
-        ///// <summary>
-        ///// Z轴放料点
-        ///// </summary>
-        //private double ZDischargePoint { get; set; }
-
-        ///// <summary>
-        ///// R轴放料点
-        ///// </summary>
-        //private double RDischargePoint { get; set; }
+        /// <summary>
+        /// 实时坐标信息
+        /// </summary>
+        public Dictionary<string, CenterPoint> Coordinates { get; set; } = new Dictionary<string, CenterPoint>();
+
+        private CenterPoint takeLocation { get; set; } = new CenterPoint();
+        private CenterPoint releaseLocation { get; set; } = new CenterPoint();
+
+        private CenterPoint actLocation { get; set; } = new CenterPoint();
 
         /// <summary>
         /// 
@@ -113,6 +87,11 @@ namespace SCADA_DAQ.Customer.Machines
              .Select(t => new Alarm() { AlarmCode = t.AlarmCode_Str, Desc = t.AlarmDesc_Str })?
              .ToLookup(t => t.AlarmCode).ToDictionary(t => t.Key, t => t.First());
 
+            Coordinates.Add("机械0点", CustomerEnv.CustomerConfig.MachineOrigin);
+            Coordinates.Add("纸箱位置", CustomerEnv.CustomerConfig.CaputreBoxLocation);
+            Coordinates.Add("抓取位置", takeLocation);
+            Coordinates.Add("释放位置", releaseLocation);
+            Coordinates.Add("实时位置", actLocation);
         }
 
         /// <summary>
@@ -144,9 +123,7 @@ namespace SCADA_DAQ.Customer.Machines
                 var BoxLength = (int)StackSln.BoxLength_Dec;
                 var BoxWidth = (int)StackSln.BoxWidth_Dec;
                 var BoxHeight = (int)StackSln.BoxHeight_Dec;
-                var TakeBoxX = GetListenReg("X轴取料点位置").Int32;
-                var TakeBoxY = GetListenReg("Y轴取料点位置").Int32;
-                var TakeBoxZ = GetListenReg("Z轴取料点位置").Int32;
+
                 var TakeBoxR = GetListenReg("R轴取料点位置").Int32;
                 var PutBoxX = GetListenReg("X轴放料点位置").Int32;
                 var PutBoxY = GetListenReg("Y轴放料点位置").Int32;
@@ -156,31 +133,38 @@ namespace SCADA_DAQ.Customer.Machines
                 var Ymm = (int)GetListenReg("Y伺服每mm脉冲数").Float;
                 var Zmm = (int)GetListenReg("Z伺服每mm脉冲数").Float;
                 var Rmm = (int)GetListenReg("R伺服每mm脉冲数").Float;
-                int jiaodu = 0;
 
-                var TakeBoxYIsSucess = GetListenReg("Y轴取料点上方").WriteReg(TakeBoxY);
-                var TakeBoxXIsSucess = GetListenReg("X轴取料点上方").WriteReg((((BoxLength * Xmm) - (200 * Xmm)) / 2) + TakeBoxX);//(箱子长度-吸盘长度)/2=X轴左移距离
+                //var TakeBoxYIsSucess = GetListenReg("Y轴取料点上方").WriteReg(TakeBoxY);
+                //var TakeBoxXIsSucess = GetListenReg("X轴取料点上方").WriteReg((((BoxLength * Xmm) - (200 * Xmm)) / 2) + TakeBoxX);//(箱子长度-吸盘长度)/2=X轴左移距离
+                //var TakeBoxZIsSucess = GetListenReg("Z轴取料点").WriteReg(((BoxHeight - 10) * Zmm) + TakeBoxZ);
+
+
+                takeLocation.X = CustomerEnv.CustomerConfig.CaputreBoxLocation.X - CustomerEnv.CustomerConfig.MachineOrigin.X - StackSln.BoxWidth_Dec / 2;
+                takeLocation.Y = CustomerEnv.CustomerConfig.MachineOrigin.Y - CustomerEnv.CustomerConfig.MachineOrigin.Y - StackSln.BoxWidth_Dec / 2;
+                takeLocation.Z = CustomerEnv.CustomerConfig.MachineOrigin.Z - CustomerEnv.CustomerConfig.MachineOrigin.Z + StackSln.BoxHeight_Dec;
+                takeLocation.R = 0;
 
-                var TakeBoxZIsSucess = GetListenReg("Z轴取料点").WriteReg(((BoxHeight - 10) * Zmm) + TakeBoxZ);
+                var TakeBoxYIsSucess = GetListenReg(Tag_Y轴取料点上方).WriteReg($"{takeLocation.X}");
+                var TakeBoxXIsSucess = GetListenReg(Tag_X轴取料点上方).WriteReg($"{takeLocation.Y}");
+                var TakeBoxZIsSucess = GetListenReg(Tag_Z轴取料点).WriteReg($"{takeLocation.Z}");
 
-                if (StackCapture.RotationAngle == 90) { jiaodu = 12760; }
-                else if (StackCapture.RotationAngle == -90) { jiaodu = 12760; }
-                else if (StackCapture.RotationAngle == 180 || StackCapture.RotationAngle == -180) { jiaodu = 25520; }
-                var x = PutBoxX + ((int)StackCapture.CaptureX * Xmm);
-                var y = PutBoxY + ((int)StackCapture.CaptureY * Ymm);
-                var z = (int)(StackCapture.CaptureZ + (StackCapture.CaptureZ / 2));
+                releaseLocation.X = (decimal)StackCapture.CaptureX - CustomerEnv.CustomerConfig.MachineOrigin.X;
+                releaseLocation.Y = (decimal)StackCapture.CaptureY - CustomerEnv.CustomerConfig.MachineOrigin.Y;
+                releaseLocation.Z = (decimal)StackCapture.CaptureZ + StackSln.BoxHeight_Dec / 2 - CustomerEnv.CustomerConfig.MachineOrigin.Z;
+                releaseLocation.R = (decimal)currentBox.RotationAngle;
 
+                var PutBoxXIsSucess = GetListenReg(Tag_X轴放料点上方).WriteReg($"{(int)releaseLocation.X}");
+                var PutBoxYIsSucess = GetListenReg(Tag_Y轴放料点上方).WriteReg($"{(int)releaseLocation.Y}");
+                var PutBoxRIsSucess = GetListenReg(Tag_R轴放料点角度).WriteReg($"{(int)currentBox.RotationAngle}");
+                var PutBoxZIsSucess = GetListenReg(Tag_Z轴放料点).WriteReg($"{(int)releaseLocation.Z}");
 
-                var PutBoxXIsSucess = GetListenReg("X轴放料点上方").WriteReg($"{x}");
-                var PutBoxYIsSucess = GetListenReg("Y轴放料点上方").WriteReg($"{y}");
-                var PutBoxRIsSucess = GetListenReg("R轴放料点角度").WriteReg($"{jiaodu}");
-                var PutBoxZIsSucess = GetListenReg("Z轴放料点").WriteReg($"{z}");
                 if (TakeBoxYIsSucess && TakeBoxXIsSucess && TakeBoxZIsSucess &&
                     PutBoxXIsSucess && PutBoxYIsSucess && PutBoxRIsSucess && PutBoxZIsSucess)
                 {
                     GetListenReg("HMI开始作业").WriteReg(1);
                 }
-                Log.Info($"开始堆码,X:{x / (Xmm == 0 ? 1 : Xmm)},Y:{y / (Ymm == 0 ? 1 : Ymm)},Z:{z},角度:{jiaodu}");
+                Log.Info($"开始堆码,抓取,X:{takeLocation.X},Y:{takeLocation.Y},Z:{takeLocation.Y},角度:{0}\r\n" +
+                    $"摆放,X:{releaseLocation.X},Y:{releaseLocation.Y},Z:{releaseLocation.Z},角度:{releaseLocation.R}");
             }
             if (reg.Comment.Variable == "作业完成" && reg.Value == 1)
             {
@@ -199,8 +183,6 @@ namespace SCADA_DAQ.Customer.Machines
                     {
                         CurrentCaputerIndex++;   //抓取完毕,序号自增
                     }
-
-
                 }
                 else
                 {
@@ -223,6 +205,7 @@ namespace SCADA_DAQ.Customer.Machines
             StackSln.BoxHeight_Dec = (decimal)parameter.BoxHeight;
 
             StackSln.StackCaptureList = Env.DAL.App_Stack_Capture.GetData<CaptureModel>(t => t.SlnId == parameter.ID);
+            CurrentCaputerIndex = 1;            //修改方案后重置抓取序号
         }
 
         /// <summary>
@@ -234,6 +217,11 @@ namespace SCADA_DAQ.Customer.Machines
         {
             if (RedundancyService?.RedundancyState == RedundancyStates.Standby) { return; }  //如果是待机模式就不执行下面的逻辑
             base.ScanCompleted(sender, e);
+
+            actLocation.X = (decimal)GetListenReg(Tag_X轴所在位置mm).ScaleValue;
+            actLocation.Y = (decimal)GetListenReg(Tag_Y轴所在位置mm).ScaleValue;
+            actLocation.Z = (decimal)GetListenReg(Tag_Z轴所在位置mm).ScaleValue;
+            actLocation.R = (decimal)GetListenReg(Tag_R轴所在位置mm).ScaleValue;
         }
 
         /// <summary>

+ 96 - 0
SCADA_DAQ/Customer/Models/CenterPoint.cs

@@ -0,0 +1,96 @@
+using ControlzEx.Standard;
+using SCADA.CommonLib;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SCADA_DAQ.Customer.Models
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    public class CenterPoint : ObservableObject
+    {
+
+        /// <summary>
+        /// 
+        /// </summary>
+        [AutoViewProperty("X位置",Icon = "Material.AxisXArrow")]
+        public decimal X
+        {
+            get { return _X; }
+            set
+            {
+                if (value != _X)
+                {
+                    _X = value;
+                    OnPropertyChanged(nameof(X));
+                }
+            }
+        }
+        private decimal _X;
+
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        [AutoViewProperty("Y位置",Icon = "Material.AxisYArrow")]
+        public decimal Y
+        {
+            get { return _Y; }
+            set
+            {
+                if (value != _Y)
+                {
+                    _Y = value;
+                    OnPropertyChanged(nameof(Y));
+                }
+            }
+        }
+        private decimal _Y;
+
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        [AutoViewProperty("Z位置", Icon = "Material.AxisZArrow")]
+        public decimal Z
+        {
+            get { return _Z; }
+            set
+            {
+                if (value != _Z)
+                {
+                    _Z = value;
+                    OnPropertyChanged(nameof(Z));
+                }
+            }
+        }
+        private decimal _Z;
+
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        [AutoViewProperty("角度",Icon = "Material.AxisZRotateCounterclockwise")]
+        public decimal R
+        {
+            get { return _R; }
+            set
+            {
+                if (value != _R)
+                {
+                    _R = value;
+                    OnPropertyChanged(nameof(R));
+                }
+            }
+        }
+        private decimal _R;
+
+    }
+}

+ 17 - 14
SCADA_DAQ/Customer/Models/CustomerConfig.cs

@@ -12,42 +12,45 @@ namespace SCADA_DAQ.Customer.Models
     /// </summary>
     public class CustomerConfig : ObservableObject
     {
+
         /// <summary>
         /// 
         /// </summary>
-        [AutoViewProperty("同步批次大小", Icon = "Material.FormatListGroup")]
-        public int BatchSize
+        [AutoViewProperty("机械0点相对于栈板中心", Icon = "ImageFilterCenterFocus")]
+        public CenterPoint MachineOrigin
         {
-            get { return _BatchSize; }
+            get { return _MachineOrigin; }
             set
             {
-                if (value != _BatchSize)
+                if (value != _MachineOrigin)
                 {
-                    _BatchSize = value;
-                    OnPropertyChanged(nameof(BatchSize));
+                    _MachineOrigin = value;
+                    OnPropertyChanged(nameof(MachineOrigin));
                 }
             }
         }
-        private int _BatchSize=10;
+        private CenterPoint _MachineOrigin = new CenterPoint();
+
 
 
         /// <summary>
         /// 
         /// </summary>
-        [AutoViewProperty("同步周期(S)", Icon = "Material.DatabaseSyncOutline")]
-        public int SyncCycle
+        [AutoViewProperty("纸箱抓取位置相对于栈板中心", Icon = "ImageFilterCenterFocus")]
+        public CenterPoint CaputreBoxLocation
         {
-            get { return _SyncCycle; }
+            get { return _CaputreBoxLocation; }
             set
             {
-                if (value != _SyncCycle)
+                if (value != _CaputreBoxLocation)
                 {
-                    _SyncCycle = value;
-                    OnPropertyChanged(nameof(SyncCycle));
+                    _CaputreBoxLocation = value;
+                    OnPropertyChanged(nameof(CaputreBoxLocation));
                 }
             }
         }
-        private int _SyncCycle = 10;
+        private CenterPoint _CaputreBoxLocation = new CenterPoint();
+
 
     }
 }

+ 104 - 12
SCADA_DAQ/Customer/UctFrmPalletizingManual.xaml

@@ -1,10 +1,12 @@
 <wpfcontrol:BaseUctFrm  xmlns:wpfcontrol="clr-namespace:SCADA.CommonCtrl.WpfControl;assembly=SCADA.CommonCtrl"
                         x:Class="SCADA_DAQ.Customer.UctFrmPalletizingManual"
-      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-      xmlns:local="clr-namespace:SCADA_DAQ.Customer" xmlns:uct="clr-namespace:SCADA_DAQ.Customer.Views.Uct" xmlns:stacking="clr-namespace:SCADA_DAQ.Plugin.RobotUI.Stacking;assembly=SCADA_DAQ.Plugin.RobotUI"
+                        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+                        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+                        xmlns:local="clr-namespace:SCADA_DAQ.Customer" 
+                        xmlns:uct="clr-namespace:SCADA_DAQ.Customer.Views.Uct" 
+                        xmlns:stacking="clr-namespace:SCADA_DAQ.Plugin.RobotUI.Stacking;assembly=SCADA_DAQ.Plugin.RobotUI" xmlns:dashboard="clr-namespace:SCADA.CommonCtrl.Dashboard;assembly=SCADA.CommonCtrl"
                         mc:Ignorable="d" 
       d:DesignHeight="450" d:DesignWidth="800"
       Title="UctFrmPalletizingManual">
@@ -39,7 +41,7 @@
                     </wpfcontrol:Card>
                 </Grid>
             </Grid>
-            <Grid Grid.Row="1" MaxHeight="400">
+            <Grid Grid.Row="1" MaxHeight="300">
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="2*"/>
                     <ColumnDefinition Width="Auto"/>
@@ -48,27 +50,117 @@
                 <Grid Grid.Column="1">
                     <uct:UctOutputControl/>
                 </Grid>
-
             </Grid>
 
         </Grid>
-        <Grid Grid.Row="1">
+        <Grid Grid.Row="1" MinHeight="280">
             <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="1*"/>
                 <ColumnDefinition Width="1*"/>
-                <ColumnDefinition Width="1*"/>
+                <ColumnDefinition Width="380"/>
             </Grid.ColumnDefinitions>
             <Grid  Grid.Column="2" >
-                <uct:UctAxisGroup x:Name="AxisGroup"/>
+                <wpfcontrol:Card>
+                    <wpfcontrol:Card.Resources>
+                        <Style x:Key="DashboardRowStyle" TargetType="{x:Type DataGridRow}">
+                            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
+                            <Setter Property="SnapsToDevicePixels"   Value="true" />
+                            <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
+                            <Setter Property="Margin" Value="1" />
+                            <Setter Property="Template">
+                                <Setter.Value>
+                                    <ControlTemplate TargetType="{x:Type DataGridRow}">
+                                        <Border x:Name="DGR_Border"  BorderBrush="{TemplateBinding BorderBrush}"
+                                            BorderThickness="{TemplateBinding BorderThickness}"
+                                            Background="{TemplateBinding Background}"
+                                            SnapsToDevicePixels="True"
+                                            CornerRadius="10">
+                                            <SelectiveScrollingGrid>
+                                                <SelectiveScrollingGrid.ColumnDefinitions>
+                                                    <ColumnDefinition Width="Auto" />
+                                                    <ColumnDefinition Width="*" />
+                                                </SelectiveScrollingGrid.ColumnDefinitions>
+                                                <SelectiveScrollingGrid.RowDefinitions>
+                                                    <RowDefinition Height="*" />
+                                                    <RowDefinition Height="Auto" />
+                                                </SelectiveScrollingGrid.RowDefinitions>
+                                                <DataGridCellsPresenter Grid.Column="1"
+                                                    Background="Transparent"
+                                                    ItemsPanel="{TemplateBinding ItemsPanel}"
+                                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
+                                                    Margin="8,4" />
+                                            </SelectiveScrollingGrid>
+                                        </Border>
+                                    </ControlTemplate>
+                                </Setter.Value>
+                            </Setter>
+                            <Style.Triggers>
+                                <Trigger Property="AlternationIndex" Value="0">
+                                    <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray10}" />
+                                </Trigger>
+                                <Trigger Property="AlternationIndex" Value="1">
+                                    <Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray10}" />
+                                </Trigger>
+                            </Style.Triggers>
+                        </Style>
+                        <Style x:Key="DashboardColumnHeaderStyle"  TargetType="{x:Type DataGridColumnHeader}">
+                            <Setter Property="Background" Value="Transparent" />
+                            <Setter Property="HorizontalContentAlignment"   Value="Center" />
+                            <Setter Property="VerticalAlignment"  Value="Center" />
+                            <Setter Property="Margin" Value="30,8,8,8" />
+                            <Setter Property="FontWeight" Value="Black"/>
+                            <Setter Property="VerticalContentAlignment"  Value="Center" />
+
+                            <Setter Property="Template">
+                                <Setter.Value>
+                                    <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
+                                        <Border x:Name="DGRH_Border"
+                                            BorderBrush="{TemplateBinding BorderBrush}"
+                                            BorderThickness="{TemplateBinding BorderThickness}"
+                                            Background="{TemplateBinding Background}"
+                                            SnapsToDevicePixels="True"
+                                            CornerRadius="10">
+                                            <ContentPresenter HorizontalAlignment="Center" RecognizesAccessKey="True"
+                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center">
+                                                <ContentPresenter.Resources>
+                                                    <Style TargetType="{x:Type Border}">
+                                                        <Setter Property="Background"  Value="Transparent" />
+                                                    </Style>
+                                                </ContentPresenter.Resources>
+                                            </ContentPresenter>
+                                        </Border>
+                                    </ControlTemplate>
+                                </Setter.Value>
+                            </Setter>
+                        </Style>
+
+                        <Style  x:Key="ValueCellStyle" TargetType="{x:Type DataGridCell}">
+                            <Setter Property="FontWeight" Value="Black"/>
+                            <Setter Property="Foreground" Value="{StaticResource DarkPrimaryBrush}"/>
+                            <Setter Property="HorizontalAlignment" Value="Center"/>
+                        </Style>
+                    </wpfcontrol:Card.Resources>
+
+                    <dashboard:DashboardDataGrid IsReadOnly="True" IsEnabled="False" FontSize="18" x:Name="DG_RunPara"
+                                                 ColumnHeaderBackground="{DynamicResource MahApps.Brushes.Gray8}"  AutoGenerateColumns="False" ColumnHeaderStyle="{StaticResource DashboardColumnHeaderStyle}" RowStyle="{StaticResource DashboardRowStyle}">
+                        <dashboard:DashboardDataGrid.Columns>
+                            <DataGridTextColumn Header="" Binding="{Binding Key}" Width="90"/>
+                            <DataGridTextColumn Header="X" Binding="{Binding Value.X}" Width="70"/>
+                            <DataGridTextColumn Header="Y" Binding="{Binding Value.Y}" Width="70" CellStyle="{StaticResource ValueCellStyle}"/>
+                            <DataGridTextColumn Header="Z" Binding="{Binding Value.Z}" Width="70"/>
+                            <DataGridTextColumn Header="R" Binding="{Binding Value.R}" Width="70"/>
+                        </dashboard:DashboardDataGrid.Columns>
+                    </dashboard:DashboardDataGrid>
+                </wpfcontrol:Card>
             </Grid>
             <Grid>
                 <stacking:UctStack3D x:Name="D3_Stack"/>
             </Grid>
-            
+
             <Grid Grid.Column="1">
                 <stacking:UctStackLayer x:Name="board1"/>
             </Grid>
-    
+
         </Grid>
 
 

+ 5 - 22
SCADA_DAQ/Customer/UctFrmPalletizingManual.xaml.cs

@@ -50,7 +50,6 @@ namespace SCADA_DAQ.Customer
             InitializeComponent();
             ToolBar.Visibility = Visibility.Collapsed;
             plc = MachineServer.GetInstance().GetMachine<SampleMachine>("Device1");
-            AxisGroup.SetMacBinding(plc);
 
             plc.CaptureFinished += Plc_CaptureFinished;
             plc.StackStarted += Plc_StackStarted; ;
@@ -99,6 +98,7 @@ namespace SCADA_DAQ.Customer
                 }, 2, Orientation.Horizontal, Orientation.Horizontal, AutoViewElementKind.TextBlock)
             { ContentWidth = 50 };
 
+            DG_RunPara.ItemsSource = plc.Coordinates;
             DG_StackLayout.SetBinding(SmartGrid.ItemsSourceProperty, new Binding("StackCaptureList"));
             DG_StackLayout.DataContext = plc.StackSln;
 
@@ -123,17 +123,8 @@ namespace SCADA_DAQ.Customer
         {
             Dispatcher.Invoke(() =>
             {
-                D3_Stack.Add3DBox(new StackBoxModel()
-                {
-                    BoxHeight = stackParameter.BoxHeight,
-                    BoxLabel = "三倍",
-                    BoxLength = stackParameter.BoxLength,
-                    BoxWidth = stackParameter.BoxWidth,
-                    LabelLocation = stackParameter.LableLocation,
-                    CaptureInfo = e.CurrentCapture
-                    //Width=stackParameter.BoardWidth,
-                    //Height=stackParameter.BoardLength,
-                });
+                e.CurrentCapture.BoxInfo.CaptureInfo = e.CurrentCapture;
+                D3_Stack.Add3DBox(e.CurrentCapture.BoxInfo);
             });
         }
 
@@ -154,16 +145,8 @@ namespace SCADA_DAQ.Customer
                 {
                     stackParameter.Update(sln);
                     plc.SetSln(sln);
-
-                    var stack = new StackManage();
-                    var boxSource = new List<StackBoxModel>();
-                    for (int i = 0; i < 32; i++)
-                    {
-                        boxSource.Add(new StackBoxModel());
-                    }
-                    var layer1 = stack.CreateLayout(boxSource, stackParameter, 32, sln.LayoutId);
-                    layer1 = stack.GetBestLayerBoxs(layer1, stackParameter);
-                    board1.Init(stackParameter, layer1);
+                    var boxs = plc.StackSln.StackCaptureList.GroupBy(t => t.LayearNo).First().Select(t => t.BoxInfo).ToList();
+                    board1.Init(stackParameter, boxs);
                 }
             }
         }

+ 2 - 3
SCADA_DAQ/Customer/UctFrmParameterSet.xaml.cs

@@ -33,9 +33,8 @@ namespace SCADA_DAQ.Customer
             ToolBar.Visibility = Visibility.Collapsed;
 
             Gp_Config.Content = new AutoView(
-             CustomerEnv.CustomerConfig,
-             nameof(CustomerConfig.BatchSize),
-             nameof(CustomerConfig.SyncCycle));
+             CustomerEnv.CustomerConfig)
+            { MaxTitleWidth = 200 };
 
             //Gp_Config.Content = new AutoView(
             //    CustomerEnv.CustomerConfig,

BIN
SCADA_DAQ/Data/Platform.zip


+ 12 - 12
SCADA_DAQ/Machines/SampleMachine_汇川码垛.cs

@@ -913,7 +913,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D202【X轴所在位置mm】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:X轴所在位置mm</para> 
 		/// </summary>
 		public const string @Tag_X轴所在位置mm="X轴所在位置mm";
@@ -941,7 +941,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D206【Y轴所在位置mm】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:Y轴所在位置mm</para> 
 		/// </summary>
 		public const string @Tag_Y轴所在位置mm="Y轴所在位置mm";
@@ -969,7 +969,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D210【Z轴所在位置mm】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:Z轴所在位置mm</para> 
 		/// </summary>
 		public const string @Tag_Z轴所在位置mm="Z轴所在位置mm";
@@ -997,7 +997,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D214【R轴所在位置mm】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:R轴所在位置mm</para> 
 		/// </summary>
 		public const string @Tag_R轴所在位置mm="R轴所在位置mm";
@@ -1011,7 +1011,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D216【X轴取料点位置】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:X轴取料点位置</para> 
 		/// </summary>
 		public const string @Tag_X轴取料点位置="X轴取料点位置";
@@ -1025,7 +1025,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D218【X轴放料点位置】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:X轴放料点位置</para> 
 		/// </summary>
 		public const string @Tag_X轴放料点位置="X轴放料点位置";
@@ -1039,7 +1039,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D220【Y轴取料点位置】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:Y轴取料点位置</para> 
 		/// </summary>
 		public const string @Tag_Y轴取料点位置="Y轴取料点位置";
@@ -1053,7 +1053,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D222【Y轴放料点位置】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:Y轴放料点位置</para> 
 		/// </summary>
 		public const string @Tag_Y轴放料点位置="Y轴放料点位置";
@@ -1067,7 +1067,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D224【Z轴取料点位置】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:Z轴取料点位置</para> 
 		/// </summary>
 		public const string @Tag_Z轴取料点位置="Z轴取料点位置";
@@ -1081,7 +1081,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D226【Z轴放料点位置】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:Z轴放料点位置</para> 
 		/// </summary>
 		public const string @Tag_Z轴放料点位置="Z轴放料点位置";
@@ -1095,7 +1095,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D228【R轴取料点位置】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:R轴取料点位置</para> 
 		/// </summary>
 		public const string @Tag_R轴取料点位置="R轴取料点位置";
@@ -1109,7 +1109,7 @@ namespace SCADA_DAQ.Customer.Machines
 			
 		/// <summary>寄存器:D230【R轴放料点位置】
 		/// <para>单位:</para> 
-		/// <para>缩放:1 类型: Float</para> 
+		/// <para>缩放:1 类型: Int32</para> 
 		/// <para>备注:R轴放料点位置</para> 
 		/// </summary>
 		public const string @Tag_R轴放料点位置="R轴放料点位置";