肖奇伟 3 дней назад
Родитель
Сommit
e9124f4229
31 измененных файлов с 369 добавлено и 265 удалено
  1. BIN
      Lib/SCADA.CommonCtrl.dll
  2. BIN
      Lib/SCADA.CommonLib.dll
  3. 5 0
      Lib/SCADA.CommonLib.xml
  4. BIN
      Lib/SCADA.dll
  5. 1 1
      Lib/SCADA.xml
  6. BIN
      Lib/SCADA_DAQ.Plugin.Core.dll
  7. BIN
      Lib/SCADA_DAQ.Plugin.CoreUI.dll
  8. BIN
      Lib/SCADA_DAQ.Plugin.Machine.dll
  9. BIN
      Lib/SCADA_DAQ.Plugin.MachineUI.dll
  10. BIN
      Lib/SCADA_DAQ.Plugin.RESTful.dll
  11. BIN
      Lib/SCADA_DAQ.Plugin.Robot.dll
  12. BIN
      Lib/SCADA_DAQ.Plugin.RobotUI.dll
  13. 0 9
      SCADA_DAQ/Customer/CustomerEnv.cs
  14. 68 21
      SCADA_DAQ/Customer/Machines/SampleMachine.cs
  15. 63 62
      SCADA_DAQ/Customer/Models/StackCaptureModel.cs
  16. 21 3
      SCADA_DAQ/Customer/Models/StackSlnModel.cs
  17. 19 0
      SCADA_DAQ/Customer/UctFrmManual.xaml
  18. 32 0
      SCADA_DAQ/Customer/UctFrmManual.xaml.cs
  19. 46 51
      SCADA_DAQ/Customer/UctFrmPalletizingManual.xaml
  20. 63 82
      SCADA_DAQ/Customer/UctFrmPalletizingManual.xaml.cs
  21. 8 7
      SCADA_DAQ/Customer/Views/Uct/UctAxisGroup.xaml
  22. 7 0
      SCADA_DAQ/Customer/Views/Uct/UctAxisGroup.xaml.cs
  23. 8 26
      SCADA_DAQ/Customer/Views/Uct/UctOutputControl.xaml
  24. 1 0
      SCADA_DAQ/Customer/Views/Uct/UctOutputControl.xaml.cs
  25. 1 0
      SCADA_DAQ/Customer/Views/Uct/UctSetAxisGroupParameter.xaml.cs
  26. 1 0
      SCADA_DAQ/Customer/Views/Uct/UctSetSpeed.xaml.cs
  27. 2 2
      SCADA_DAQ/Customer/Views/Uct/UctShowItem.xaml
  28. 1 1
      SCADA_DAQ/Env.cs
  29. 13 0
      SCADA_DAQ/LocalResource.Designer.cs
  30. 3 0
      SCADA_DAQ/LocalResource.resx
  31. 6 0
      SCADA_DAQ/SCADA_DAQ.csproj.user

BIN
Lib/SCADA.CommonCtrl.dll


BIN
Lib/SCADA.CommonLib.dll


+ 5 - 0
Lib/SCADA.CommonLib.xml

@@ -1078,6 +1078,11 @@
             下限
             </summary>
         </member>
+        <member name="P:SCADA.CommonLib.CommonModel.DetectionItem`1.SetupValue">
+            <summary>
+            设定值
+            </summary>
+        </member>
         <member name="T:SCADA.CommonLib.CommonModel.DetectionStatus">
             <summary>
             


+ 1 - 1
Lib/SCADA.xml

@@ -99,7 +99,7 @@
             低位在前
             </summary>
         </member>
-        <member name="F:SCADA.OCTByteSeq.EFGJABCD">
+        <member name="F:SCADA.OCTByteSeq.EFGHABCD">
             <summary>
             高低位在前(默认)
             </summary>

BIN
Lib/SCADA_DAQ.Plugin.Core.dll


BIN
Lib/SCADA_DAQ.Plugin.CoreUI.dll


BIN
Lib/SCADA_DAQ.Plugin.Machine.dll


BIN
Lib/SCADA_DAQ.Plugin.MachineUI.dll


BIN
Lib/SCADA_DAQ.Plugin.RESTful.dll


BIN
Lib/SCADA_DAQ.Plugin.Robot.dll


BIN
Lib/SCADA_DAQ.Plugin.RobotUI.dll


+ 0 - 9
SCADA_DAQ/Customer/CustomerEnv.cs

@@ -14,14 +14,5 @@ namespace SCADA_DAQ.Customer
 
         public static AutoSaveParameterItem<CustomerConfig> _confg { get; set; } = AutoSaveParameterItem.Create("App.CustomerConfig", new CustomerConfig());
 
-        /// <summary>
-        /// 当前码垛方案
-        /// </summary>
-        public static StackSlnModel StackSln { get; set; } = new StackSlnModel();
-
-        /// <summary>
-        /// 当前码垛步骤
-        /// </summary>
-        public static StackCaptureModel StackCapture { get; set; } = new StackCaptureModel();
     }
 }

+ 68 - 21
SCADA_DAQ/Customer/Machines/SampleMachine.cs

@@ -2,10 +2,12 @@
 using SCADA;
 using SCADA.CommonLib;
 using SCADA.CommonLib.Data.DIL;
+using SCADA.CommonLib.Helper;
 using SCADA.Drive;
 using SCADA_DAQ.Customer.Models;
 using SCADA_DAQ.Plugin.Core.Service;
 using SCADA_DAQ.Plugin.Machine.Device;
+using SCADA_DAQ.Plugin.Robot.Stacking;
 using System;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
@@ -31,6 +33,22 @@ namespace SCADA_DAQ.Customer.Machines
         /// </summary>
         public Redundancy RedundancyService { get; set; }   //冗余服务
 
+
+        /// <summary>
+        /// 当前码垛方案
+        /// </summary>
+        public StackSlnModel StackSln { get; set; } = new StackSlnModel();
+
+        /// <summary>
+        /// 当前码垛步骤
+        /// </summary>
+        public CaptureModel StackCapture { get; set; } = new CaptureModel();
+
+        /// <summary>
+        /// 当前抓取序号
+        /// </summary>
+        public int CurrentCaputerIndex { get; set; } = 1;
+
         ///// <summary>
         ///// X轴取料点
         ///// </summary>
@@ -95,16 +113,22 @@ namespace SCADA_DAQ.Customer.Machines
             if (RedundancyService?.RedundancyState == RedundancyStates.Standby) { return; }  //如果是待机模式就不执行下面的逻辑
             base.RegReadValueChanged(sender, e);
             var reg = (RegInfo)sender;
-            //if (reg.Comment.Variable == "Sys_1minPlus")
-            //{
-            //    Log.Info($"寄存器变化:{reg.Comment.Variable},value:{reg.Value}");
-            //}
-            if (reg.Comment.Variable == "手动来料" && reg.Value == 1 && base.GetListenReg($"手动0自动1").Value == 1 && base.GetListenReg($"码垛开始").Value == 1)
+            if (reg.Comment.Variable == "手动来料" &&
+                reg.Value == 1 &&
+                GetListenReg($"手动0自动1").Value == 1 &&
+                GetListenReg($"码垛开始").Value == 1)
             {
+                if (StackSln.StackCaptureList == null || StackSln.StackCaptureList.Count == 0)
+                {
+                    Log.Warn($"请选择堆码方案");
+                    return;
+                }
+                var currentBox = StackSln.StackCaptureList[CurrentCaputerIndex - 1];  //查找当前需要的Box
+                StackCapture.Update(currentBox);     //用当前的box数据刷新 抓取数据
 
-                var BoxLength = (int)CustomerEnv.StackSln.BoxLength_Dec;
-                var BoxWidth = (int)CustomerEnv.StackSln.BoxWidth_Dec;
-                var BoxHeight = (int)CustomerEnv.StackSln.BoxHeight_Dec;
+                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;
@@ -124,31 +148,54 @@ namespace SCADA_DAQ.Customer.Machines
 
                 var TakeBoxZIsSucess = GetListenReg("Z轴取料点").WriteReg(((BoxHeight - 10) * Zmm) + TakeBoxZ);
 
-                if (CustomerEnv.StackCapture.RotationAngle_Dec == 90) { jiaodu = 12760; }
-                else if (CustomerEnv.StackCapture.RotationAngle_Dec == -90) { jiaodu = 12760; }
-                else if (CustomerEnv.StackCapture.RotationAngle_Dec == 180 || CustomerEnv.StackCapture.RotationAngle_Dec == -180) { jiaodu = 25520; }
-                var PutBoxXIsSucess = GetListenReg("X轴放料点上方").WriteReg(PutBoxX + ((int)CustomerEnv.StackCapture.XLocation_Dec * Xmm));
-                var PutBoxYIsSucess = GetListenReg("Y轴放料点上方").WriteReg(PutBoxY + ((int)CustomerEnv.StackCapture.YLocation_Dec * Ymm));
-                var PutBoxRIsSucess = GetListenReg("R轴放料点角度").WriteReg(jiaodu);
+                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));
+
 
-                var PutBoxZIsSucess = GetListenReg("Z轴放料点").WriteReg((int)(CustomerEnv.StackCapture.ZLocation_Dec + (CustomerEnv.StackCapture.ZLocation_Dec / 2)));
-                if (TakeBoxYIsSucess && TakeBoxXIsSucess && TakeBoxZIsSucess && PutBoxXIsSucess && PutBoxYIsSucess && PutBoxRIsSucess && PutBoxZIsSucess)
+                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}");
             }
             if (reg.Comment.Variable == "作业完成" && reg.Value == 1)
             {
-                if (CustomerEnv.StackSln.StackCaptureList.Count == CustomerEnv.StackCapture.CaptureIndex_Int)
+                if (CurrentCaputerIndex == StackCapture.CaptureIndex)   // 判断当前序号是否和执行的序号一致,防止误触发
                 {
-                    GetListenReg("手动0自动1").WriteReg(0);
+                    CurrentCaputerIndex++;   //抓取完毕,序号自增
+                }
+                else
+                {
+                    Log.Warn($"当前的抓取序号和箱子序号不一致,抓取序号:{CurrentCaputerIndex},箱子序号:{StackCapture.CaptureIndex}");
                 }
-                CustomerEnv.StackSln.StackCaptureList.Remove(CustomerEnv.StackCapture);
-                CustomerEnv.StackCapture = CustomerEnv.StackSln.StackCaptureList.FirstOrDefault();
-
             }
         }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="parameter"></param>
+        public void SetSln(StackParameter parameter)
+        {
+            StackSln.BoardLength_Dec = (decimal)parameter.BoardLength;
+            StackSln.BoardWidth_Dec = (decimal)parameter.BoardWidth;
+            StackSln.StackHeight_Dec = (decimal)parameter.StackHeight;
+            StackSln.BoxLength_Dec = (decimal)parameter.BoxLength;
+            StackSln.BoxWidth_Dec = (decimal)parameter.BoxWidth;
+            StackSln.BoxHeight_Dec = (decimal)parameter.BoxHeight;
+
+            StackSln.StackCaptureList = Env.DAL.App_Stack_Capture.GetData<CaptureModel>(t => t.SlnId == parameter.ID);
+        }
+
         /// <summary>
         /// 扫描完成事件
         /// </summary>

+ 63 - 62
SCADA_DAQ/Customer/Models/StackCaptureModel.cs

@@ -1,74 +1,75 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+//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 StackCaptureModel
-    {
-        /// <summary>
-        /// ID
-        /// </summary>
-        public int SlnId_Int { get; set; }
+//namespace SCADA_DAQ.Customer.Models
+//{
+//    /// <summary>
+//    /// 码垛方案步骤
+//    /// </summary>
+//    public class StackCaptureModel : ObservableObject
+//    {
+//        /// <summary>
+//        /// ID
+//        /// </summary>
+//        public int SlnId_Int { get; set; }
 
-        /// <summary>
-        /// 抓取序号
-        /// </summary>
-        public int CaptureIndex_Int { get; set; }
+//        /// <summary>
+//        /// 抓取序号
+//        /// </summary>
+//        public int CaptureIndex_Int { get; set; }
 
-        /// <summary>
-        /// 层号
-        /// </summary>
-        public int LayerNo_Int { get; set; }
+//        /// <summary>
+//        /// 层号
+//        /// </summary>
+//        public int LayerNo_Int { get; set; }
 
-        /// <summary>
-        /// 层内序号
-        /// </summary>
-        public int LayerIndex_Int { get; set; }
+//        /// <summary>
+//        /// 层内序号
+//        /// </summary>
+//        public int LayerIndex_Int { get; set; }
 
-        /// <summary>
-        /// X位置
-        /// </summary>
-        public decimal XLocation_Dec { get; set; }
+//        /// <summary>
+//        /// X位置
+//        /// </summary>
+//        public decimal XLocation_Dec { get; set; }
 
-        /// <summary>
-        /// Y位置
-        /// </summary>
-        public decimal YLocation_Dec { get; set; }
+//        /// <summary>
+//        /// Y位置
+//        /// </summary>
+//        public decimal YLocation_Dec { get; set; }
 
-        /// <summary>
-        /// Z位置
-        /// </summary>
-        public decimal ZLocation_Dec { get; set; }
+//        /// <summary>
+//        /// Z位置
+//        /// </summary>
+//        public decimal ZLocation_Dec { get; set; }
 
-        /// <summary>
-        /// R角度
-        /// </summary>
-        public decimal RotationAngle_Dec { get; set; }
+//        /// <summary>
+//        /// R角度
+//        /// </summary>
+//        public decimal RotationAngle_Dec { get; set; }
 
-        /// <summary>
-        /// X偏移
-        /// </summary>
-        public decimal XLocationOffset_Dec { get; set; }
+//        /// <summary>
+//        /// X偏移
+//        /// </summary>
+//        public decimal XLocationOffset_Dec { get; set; }
 
-        /// <summary>
-        /// Y偏移
-        /// </summary>
-        public decimal YLocationOffset_Dec { get; set; }
+//        /// <summary>
+//        /// Y偏移
+//        /// </summary>
+//        public decimal YLocationOffset_Dec { get; set; }
 
-        /// <summary>
-        /// Z偏移
-        /// </summary>
-        public decimal ZLocationOffset_Dec { get; set; }
+//        /// <summary>
+//        /// Z偏移
+//        /// </summary>
+//        public decimal ZLocationOffset_Dec { get; set; }
 
-        /// <summary>
-        /// R偏移
-        /// </summary>
-        public decimal RotationAngleOffset_Dec { get; set; }
-    }
-}
+//        /// <summary>
+//        /// R偏移
+//        /// </summary>
+//        public decimal RotationAngleOffset_Dec { get; set; }
+//    }
+//}

+ 21 - 3
SCADA_DAQ/Customer/Models/StackSlnModel.cs

@@ -1,4 +1,6 @@
-using System;
+using SCADA.CommonLib;
+using SCADA_DAQ.Plugin.Robot.Stacking;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -6,7 +8,10 @@ using System.Threading.Tasks;
 
 namespace SCADA_DAQ.Customer.Models
 {
-    public class StackSlnModel
+    /// <summary>
+    /// 
+    /// </summary>
+    public class StackSlnModel : ObservableObject
     {
 
         public int ID { get; set; }
@@ -58,6 +63,19 @@ namespace SCADA_DAQ.Customer.Models
         /// <summary>
         /// 方案对应的详细步骤
         /// </summary>
-        public List<StackCaptureModel> StackCaptureList { get; set; } = new List<StackCaptureModel>();
+        public List<CaptureModel> StackCaptureList
+        {
+            get { return _StackCaptureList; }
+            set
+            {
+                if (value != _StackCaptureList)
+                {
+                    _StackCaptureList = value;
+                    OnPropertyChanged(nameof(StackCaptureList));
+                }
+            }
+        }
+        private List<CaptureModel> _StackCaptureList;
+
     }
 }

+ 19 - 0
SCADA_DAQ/Customer/UctFrmManual.xaml

@@ -0,0 +1,19 @@
+<wpfcontrol:BaseUctFrm  
+             xmlns:wpfcontrol="clr-namespace:SCADA.CommonCtrl.WpfControl;assembly=SCADA.CommonCtrl"
+             x:Class="SCADA_DAQ.Customer.UctFrmManual"
+             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"
+                mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <StackPanel>
+        <uct:UctSetAxisGroupParameter/>
+
+        <uct:UctSetSpeed/>
+
+        <uct:UctMotionControl/>
+    </StackPanel>
+</wpfcontrol:BaseUctFrm>

+ 32 - 0
SCADA_DAQ/Customer/UctFrmManual.xaml.cs

@@ -0,0 +1,32 @@
+using SCADA.CommonCtrl.WpfControl;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace SCADA_DAQ.Customer
+{
+    /// <summary>
+    /// UctFrmManual.xaml 的交互逻辑
+    /// </summary>
+    public partial class UctFrmManual : BaseUctFrm
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public UctFrmManual()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 46 - 51
SCADA_DAQ/Customer/UctFrmPalletizingManual.xaml

@@ -4,78 +4,73 @@
       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: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"
                         mc:Ignorable="d" 
       d:DesignHeight="450" d:DesignWidth="800"
       Title="UctFrmPalletizingManual">
 
     <Grid>
-        <Grid.ColumnDefinitions>
-            <ColumnDefinition Width="1*"/>
-        </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
-            <RowDefinition Height="2*"/>
+            <RowDefinition Height="Auto"/>
             <RowDefinition Height="1*"/>
         </Grid.RowDefinitions>
-        <Grid Grid.Row="1">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="1*"/>
-                <ColumnDefinition Width="1*"/>
-                <ColumnDefinition Width="1*"/>
-            </Grid.ColumnDefinitions>
-            <Grid  Grid.Column="2" >
-                <uct:UctAxisGroup x:Name="AxisGroup"/>
-            </Grid>
-            <Grid Grid.Column="1">
-                <uct:UctMotionControl/>
-            </Grid>
-            <Grid>
-                <uct:UctSetSpeed/>
-            </Grid>
-        </Grid>
 
         <Grid Grid.Row="0">
             <Grid.RowDefinitions>
-                <RowDefinition Height="0.2*"/>
-                <RowDefinition Height="0.3*"/>
-                <RowDefinition Height="0.3*"/>
-                <RowDefinition Height="auto"/>
+                <RowDefinition Height="Auto"/>
+                <RowDefinition Height="Auto"/>
             </Grid.RowDefinitions>
 
-            <Grid Grid.Row="3">
+            <Grid Grid.Row="0">
+                <Grid MinHeight="100">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="Auto" MinWidth="100"/>
+                        <ColumnDefinition Width="1*"/>
+                        <ColumnDefinition Width="Auto" MinWidth="100"/>
+                    </Grid.ColumnDefinitions>
+                    <wpfcontrol:Card Margin="2">
+                        <ContentControl x:Name="StackSelection" FontSize="{DynamicResource LargeFontSize}"/>
+                    </wpfcontrol:Card>
+                    <wpfcontrol:Card Margin="2" Grid.Column="1">
+                        <ContentControl x:Name="StackInfo" FontSize="{DynamicResource LargeFontSize}" />
+                    </wpfcontrol:Card>
+                    <wpfcontrol:Card Margin="2" Grid.Column="2">
+                        <ContentControl x:Name="CurrentBoxInfo" FontSize="{DynamicResource LargeFontSize}" />
+                    </wpfcontrol:Card>
+                </Grid>
+            </Grid>
+            <Grid Grid.Row="1">
                 <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="1*"/>
-                    <ColumnDefinition Width="2.5*"/>
+                    <ColumnDefinition Width="2*"/>
+                    <ColumnDefinition Width="Auto"/>
                 </Grid.ColumnDefinitions>
-                <Grid>
-                    <uct:UctOutputControl/>
-                </Grid>
+                <wpfcontrol:SmartGrid x:Name="DG_StackLayout"  AutoGenerateColumns="True" ShowRowTips="False" ShowHeader="False"/>
                 <Grid Grid.Column="1">
-                    <uct:UctSetAxisGroupParameter/>
+                    <uct:UctOutputControl/>
                 </Grid>
+
             </Grid>
 
-            <Grid Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Row="1">
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock FontSize="20" VerticalAlignment="Center" Foreground="Black" x:Name="Stacksln"/>
-                        <wpfcontrol:AutoFilteredComboBox Margin="5" x:Name="ChooseStackSln"  VerticalAlignment="Center"  Width="150" Height="40" Grid.Column="1" FontSize="30"/>
-                        <uct:UctShowInfo x:Name="BoardWidth"  VerticalAlignment="Center" Margin="5"/>
-                        <uct:UctShowInfo x:Name="BoardLength" VerticalAlignment="Center" Margin="5"/>
-                        <uct:UctShowInfo x:Name="StackHeight" VerticalAlignment="Center" Margin="5"/>
-                        <uct:UctShowInfo x:Name="BoxWidth" VerticalAlignment="Center" Margin="5"/>
-                        <uct:UctShowInfo x:Name="BoxLength" VerticalAlignment="Center" Margin="5"/>
-                        <uct:UctShowInfo x:Name="BoxHeight" VerticalAlignment="Center" Margin="5"/>
-                        <uct:UctShowInfo x:Name="BoxLength1" VerticalAlignment="Center" Margin="5"/>
-                        <uct:UctShowInfo x:Name="BoxHeight1" VerticalAlignment="Center" Margin="5"/>
-                    </StackPanel>
+        </Grid>
+        <Grid Grid.Row="1">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="1*"/>
+                <ColumnDefinition Width="1*"/>
+                <ColumnDefinition Width="1*"/>
+            </Grid.ColumnDefinitions>
+            <Grid  Grid.Column="2" >
+                <uct:UctAxisGroup x:Name="AxisGroup"/>
+            </Grid>
+            <Grid>
+                <stacking:UctStack3D/>
             </Grid>
-            <Grid Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Row="2">
-                    <StackPanel Orientation="Horizontal">
-                        <uct:UctShowInfo x:Name="CaptureIndex"  VerticalAlignment="Center" Margin="5"/>
-                        <uct:UctShowInfo x:Name="LayerNo" VerticalAlignment="Center" Margin="5"/>
-                        <uct:UctShowInfo x:Name="LayerIndex" VerticalAlignment="Center" Margin="5"/>
-                    </StackPanel>
+            
+            <Grid Grid.Column="1">
+                <stacking:UctStackLayer x:Name="board1"/>
             </Grid>
+    
         </Grid>
+
+
     </Grid>
 </wpfcontrol:BaseUctFrm>

+ 63 - 82
SCADA_DAQ/Customer/UctFrmPalletizingManual.xaml.cs

@@ -1,10 +1,13 @@
-using SCADA.CommonCtrl.WpfControl;
+using DBModel;
+using SCADA.CommonCtrl.WpfControl;
+using SCADA.CommonLib;
 using SCADA.CommonLib.Helper;
 using SCADA.Drive;
 using SCADA_DAQ.Customer.Machines;
 using SCADA_DAQ.Customer.Models;
 using SCADA_DAQ.Customer.Views.Uct;
 using SCADA_DAQ.Plugin.Machine;
+using SCADA_DAQ.Plugin.Robot.Stacking;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -30,6 +33,10 @@ namespace SCADA_DAQ.Customer
     {
         public SampleMachine plc { get; set; }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        public StackParameter stackParameter { get; set; } = new StackParameter();
         /// <summary>
         /// 码垛方案
         /// </summary>
@@ -41,98 +48,72 @@ namespace SCADA_DAQ.Customer
             ToolBar.Visibility = Visibility.Collapsed;
             plc = MachineServer.GetInstance().GetMachine<SampleMachine>("Device1");
             AxisGroup.SetMacBinding(plc);
-            Stacksln.Text = "码垛方案:";
-            BoardWidth.Value = "0.0";
-            BoardWidth.TitleValue = "栈板宽度:";
-            BoardLength.TitleValue = "栈板长度:";
-            BoardLength.Value = "0.0";
-            StackHeight.TitleValue = "最高高度:";
-            StackHeight.Value = "0.0";
-            BoxWidth.TitleValue = "纸箱宽度:";
-            BoxHeight.TitleValue = "纸箱高度:";
-            BoxLength.TitleValue = "纸箱长度:";
-            BoxWidth.Value = "0.0";
-            BoxHeight.Value = "0.0";
-            BoxLength.Value = "0.0";
-            CaptureIndex.Value = "0";
-            CaptureIndex.TitleValue = "码垛序号:";
-            LayerNo.Value = "0";
-            LayerNo.TitleValue = "层号:";
-            LayerIndex.Value = "0";
-            LayerIndex.TitleValue = "层内序号:";
+            //Stacksln.Text = "码垛方案:";
+            //BoardWidth.Value = "0.0";
+            //BoardWidth.TitleValue = "栈板宽度:";
+            //BoardLength.TitleValue = "栈板长度:";
+            //BoardLength.Value = "0.0";
+            //StackHeight.TitleValue = "最高高度:";
+            //StackHeight.Value = "0.0";
+            //BoxWidth.TitleValue = "纸箱宽度:";
+            //BoxHeight.TitleValue = "纸箱高度:";
+            //BoxLength.TitleValue = "纸箱长度:";
+            //BoxWidth.Value = "0.0";
+            //BoxHeight.Value = "0.0";
+            //BoxLength.Value = "0.0";
 
 
-            var stackSlnList = Env.DAL.App_Stack_Sln.GetData().DtToList<StackSlnModel>();
-            var fileStr = "(";
-            for (int i = 0; i < stackSlnList.Count; i++)
-            {
-                if (i == stackSlnList.Count - 1)
-                {
-                    fileStr += $"{stackSlnList[i].ID})";
-                }
-                else
-                {
-                    fileStr += $"{stackSlnList[i].ID},";
-                }
+            StackSelection.Content = new AutoView(stackParameter, new List<string>() {
+                 nameof(stackParameter.SlnName)
+                }, 1, Orientation.Vertical,
+                Orientation.Vertical)
+            { ContentWidth = 120 };
 
-            }
-            var stackCaputerList = Env.DAL.App_Stack_Capture.GetData($"SlnId_Int in {fileStr}").DtToList<StackCaptureModel>().ToLookup(i => i.SlnId_Int);
-            foreach (var stackCaputer in stackCaputerList)
-            {
-                var stackSlnID = stackSlnList.Where(i => i.ID == stackCaputer.Key).FirstOrDefault();
-                if (stackSlnID != null)
-                {
-                    foreach (var item in stackCaputer)
-                    {
-                        stackSlnID.StackCaptureList.Add(item);
-                    }
-                }
-            }
-            StackSlnList = stackSlnList;
-            ChooseStackSln.ItemsSource = stackSlnList.Select(i => i.SlnName_Str).ToList();
-            ChooseStackSln.DropDownClosed += ChooseStackSln_DropDownClosed;
-            plc.BaseDevice.RegReadValueChanged += BaseDevice_RegReadValueChanged;
-        }
+            StackInfo.Content = new AutoView(
+                stackParameter, new List<string>() {
+                 nameof(stackParameter.BoardWidth),
+                 nameof(stackParameter.BoardLength),
+                 nameof(stackParameter.StackHeight),
 
-        private void BaseDevice_RegReadValueChanged(object sender, SCADA.Drive.RegReadValueChangedEventArgs e)
-        {
-            var reg = (RegInfo)sender;
-            if (reg.Comment.Variable == "开始作业" && reg.Value == 1)
-            {
-                Dispatcher.Invoke(() =>
-                {
-                    CaptureIndex.Value = CustomerEnv.StackCapture.CaptureIndex_Int.ToString();
-                    LayerIndex.Value = CustomerEnv.StackCapture.LayerIndex_Int.ToString();
-                    LayerNo.Value = CustomerEnv.StackCapture.LayerNo_Int.ToString();
-                });
-            }
+                 nameof(stackParameter.BoxWidth),
+                 nameof(stackParameter.BoxHeight),
+                 nameof(stackParameter.BoxWidth),
+                }, 3, Orientation.Horizontal,
+                Orientation.Horizontal, AutoViewElementKind.TextBlock)
+            { ContentWidth = 60 };
+
+            CurrentBoxInfo.Content = new AutoView(plc.StackCapture,
+                new List<string>() {
+                      nameof(CaptureModel.CaptureIndex),
+                      null,
+                      nameof(CaptureModel.LayearIndex),
+                      nameof(CaptureModel.LayearNo)
+
+                }, 2, Orientation.Horizontal, Orientation.Horizontal, AutoViewElementKind.TextBlock)
+            { ContentWidth = 50 };
+
+            DG_StackLayout.SetBinding(SmartGrid.ItemsSourceProperty, new Binding("StackCaptureList"));
+            DG_StackLayout.DataContext = plc.StackSln;
+
+            stackParameter.SlnNameSrc = Env.DAL.App_Stack_Sln.GetData().DtToList<App_Stack_Sln>().Select(t => t.SlnName_Str).ToList();
+            stackParameter.PropertyChanged += StackParameter_PropertyChanged;
         }
 
-        private void ChooseStackSln_DropDownClosed(object sender, EventArgs e)
+        private void StackParameter_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
         {
-            try
+            if (e.PropertyName == nameof(stackParameter.SlnName))
             {
-                Dispatcher.Invoke(() =>
+                var sln = Env.DAL.App_Stack_Sln.GetData<StackParameter>(t => t.SlnName == stackParameter.SlnName).FirstOrDefault();
+                if (sln != null)
                 {
-                    BoardWidth.Value = StackSlnList.Where(i => i.SlnName_Str == ChooseStackSln.Text)?.Select(i => i.BoardWidth_Dec + "mm").FirstOrDefault()?.ToString();
-                    BoardLength.Value = StackSlnList.Where(i => i.SlnName_Str == ChooseStackSln.Text)?.Select(i => i.BoardLength_Dec + "mm").FirstOrDefault()?.ToString();
-                    StackHeight.Value = StackSlnList.Where(i => i.SlnName_Str == ChooseStackSln.Text)?.Select(i => i.StackHeight_Dec + "mm").FirstOrDefault()?.ToString();
-                    BoxHeight.Value = StackSlnList.Where(i => i.SlnName_Str == ChooseStackSln.Text)?.Select(i => i.BoxHeight_Dec + "mm").FirstOrDefault()?.ToString();
-                    BoxWidth.Value = StackSlnList.Where(i => i.SlnName_Str == ChooseStackSln.Text)?.Select(i => i.BoxWidth_Dec + "mm").FirstOrDefault()?.ToString();
-                    BoxLength.Value = StackSlnList.Where(i => i.SlnName_Str == ChooseStackSln.Text)?.Select(i => i.BoxLength_Dec + "mm").FirstOrDefault()?.ToString();
-                    CaptureIndex.Value = StackSlnList.Where(i => i.SlnName_Str == ChooseStackSln.Text)?.Select(i => i.StackCaptureList.FirstOrDefault()?.CaptureIndex_Int).FirstOrDefault()?.ToString();
-                    LayerNo.Value = StackSlnList.Where(i => i.SlnName_Str == ChooseStackSln.Text)?.Select(i => i.StackCaptureList.FirstOrDefault()?.LayerNo_Int).FirstOrDefault()?.ToString();
-                    LayerIndex.Value = StackSlnList.Where(i => i.SlnName_Str == ChooseStackSln.Text)?.Select(i => i.StackCaptureList.FirstOrDefault()?.LayerIndex_Int).FirstOrDefault()?.ToString();
-                });
-                CustomerEnv.StackSln = StackSlnList.Where(i => i.SlnName_Str == ChooseStackSln.Text).FirstOrDefault();
-                CustomerEnv.StackCapture = CustomerEnv.StackSln?.StackCaptureList?.FirstOrDefault();
-            }
-            catch (Exception)
-            {
+                    stackParameter.Update(sln);
+                    plc.SetSln(sln);
 
+                    var stack = new StackManage();
+                    var layer1 = stack.CreateLayout(null, stackParameter, 32, sln.LayoutId);
+                    board1.Init(stackParameter, layer1);
+                }
             }
-
-           
         }
     }
 }

+ 8 - 7
SCADA_DAQ/Customer/Views/Uct/UctAxisGroup.xaml

@@ -1,5 +1,6 @@
-<wpfcontrol:BaseUserControl  xmlns:wpfcontrol="clr-namespace:SCADA.CommonCtrl.WpfControl;assembly=SCADA.CommonCtrl"
-                             x:Class="SCADA_DAQ.Customer.Views.Uct.UctAxisGroup"
+<wpfcontrol:BaseUserControl  
+        xmlns:wpfcontrol="clr-namespace:SCADA.CommonCtrl.WpfControl;assembly=SCADA.CommonCtrl"                   
+        x:Class="SCADA_DAQ.Customer.Views.Uct.UctAxisGroup"
       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" 
@@ -10,12 +11,12 @@
       Title="UctAxisGroup">
 
     <Grid>
-        <GroupBox Grid.Column="1" Margin="5" Header="当前位置">
+        <GroupBox Grid.Column="1" Margin="4" Header="当前位置">
             <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
-                <local:UctShowItem Title="X轴当前位置:" x:Name="XCurrentPosition" Margin="10"/>
-                <local:UctShowItem Title="Y轴当前位置:" x:Name="YCurrentPosition" Margin="10"/>
-                <local:UctShowItem Title="Z轴当前位置:" x:Name="ZCurrentPosition" Margin="10"/>
-                <local:UctShowItem Title="R轴当前位置:" x:Name="RCurrentPosition" Margin="10"/>
+                <local:UctShowItem Title="X轴当前位置:" x:Name="XCurrentPosition" Margin="6"/>
+                <local:UctShowItem Title="Y轴当前位置:" x:Name="YCurrentPosition" Margin="6"/>
+                <local:UctShowItem Title="Z轴当前位置:" x:Name="ZCurrentPosition" Margin="6"/>
+                <local:UctShowItem Title="R轴当前位置:" x:Name="RCurrentPosition" Margin="6"/>
             </StackPanel>
         </GroupBox>
     </Grid>

+ 7 - 0
SCADA_DAQ/Customer/Views/Uct/UctAxisGroup.xaml.cs

@@ -22,11 +22,18 @@ namespace SCADA_DAQ.Customer.Views.Uct
     /// </summary>
     public partial class UctAxisGroup : BaseUserControl
     {
+        /// <summary>
+        /// 
+        /// </summary>
         public UctAxisGroup()
         {
             InitializeComponent();
         }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="plc"></param>
         public void SetMacBinding(SampleMachine plc)
         {
             XCurrentPosition.DataContext = plc?.GetListenReg(SampleMachine.Tag_X轴所在位置mm);

+ 8 - 26
SCADA_DAQ/Customer/Views/Uct/UctOutputControl.xaml

@@ -14,10 +14,10 @@
                 <Grid.Resources>
                     <Style TargetType="wpfcontrol:IconButton" x:Key="SameTitle">
                         <Setter Property="ButtonStyle" Value="Info"/>
-                        <Setter Property="Width" Value="200"/>
-                        <Setter Property="Height" Value="50"/>
-                        <Setter Property="Margin" Value="5"/>
-                        <Setter Property="FontSize" Value="24"/>
+                        <Setter Property="Width" Value="140"/>
+                        <Setter Property="Height" Value="40"/>
+                        <Setter Property="Margin" Value="4"/>
+                        <Setter Property="FontSize" Value="22"/>
                         <Setter Property="FontWeight" Value="Bold"/>
                         <Style.Triggers>
                             <DataTrigger Binding="{Binding Value}" Value="1">
@@ -70,14 +70,8 @@
 
                 <wpfcontrol:IconButton  Click="RegiserReverse_Click"  x:Name="Mode" >
                     <wpfcontrol:IconButton.Style>
-                        <Style TargetType="wpfcontrol:IconButton">
-                            <Setter Property="Title" Value="手动模式"/>
-                            <Setter Property="ButtonStyle" Value="Info"/>
-                            <Setter Property="Width" Value="200"/>
-                            <Setter Property="Height" Value="50"/>
-                            <Setter Property="Margin" Value="5"/>
-                            <Setter Property="FontSize" Value="24"/>
-                            <Setter Property="FontWeight" Value="Bold"/>
+                        <Style TargetType="wpfcontrol:IconButton" BasedOn="{StaticResource SameTitle}">
+                            <Setter Property="Title" Value="手动模式 "/>
                             <Setter Property="Icon">
                                 <Setter.Value>
                                     <iconPacks:PackIconMaterial Kind="GestureTap"/>
@@ -100,14 +94,8 @@
 
                 <wpfcontrol:IconButton  Click="RegiserReverse_Click"  x:Name="Cup" Grid.Row="2">
                     <wpfcontrol:IconButton.Style>
-                        <Style TargetType="wpfcontrol:IconButton">
+                        <Style TargetType="wpfcontrol:IconButton" BasedOn="{StaticResource SameTitle}">
                             <Setter Property="Title" Value="吸盘放"/>
-                            <Setter Property="ButtonStyle" Value="Info"/>
-                            <Setter Property="Width" Value="200"/>
-                            <Setter Property="Height" Value="50"/>
-                            <Setter Property="Margin" Value="5"/>
-                            <Setter Property="FontSize" Value="24"/>
-                            <Setter Property="FontWeight" Value="Bold"/>
                             <Setter Property="Icon">
                                 <Setter.Value>
                                     <iconPacks:PackIconMaterial Kind="CircleBoxOutline"/>
@@ -130,14 +118,8 @@
 
                 <wpfcontrol:IconButton  Click="RegiserReverse_Click"  x:Name="CupBlow" Grid.Column="1" Grid.Row="2">
                     <wpfcontrol:IconButton.Style>
-                        <Style TargetType="wpfcontrol:IconButton">
+                        <Style TargetType="wpfcontrol:IconButton" BasedOn="{StaticResource SameTitle}">
                             <Setter Property="Title" Value="吸盘不吹气"/>
-                            <Setter Property="ButtonStyle" Value="Info"/>
-                            <Setter Property="Width" Value="200"/>
-                            <Setter Property="Height" Value="50"/>
-                            <Setter Property="Margin" Value="5"/>
-                            <Setter Property="FontSize" Value="24"/>
-                            <Setter Property="FontWeight" Value="Bold"/>
                             <Setter Property="Icon">
                                 <Setter.Value>
                                     <iconPacks:PackIconMaterial Kind="CircleBoxOutline"/>

+ 1 - 0
SCADA_DAQ/Customer/Views/Uct/UctOutputControl.xaml.cs

@@ -29,6 +29,7 @@ namespace SCADA_DAQ.Customer.Views.Uct
         public UctOutputControl()
         {
             InitializeComponent();
+            if (IsInDesignMode) return;
             plc = MachineServer.GetInstance().GetMachine<SampleMachine>("Device1");
             Cup.DataContext = plc.GetListenReg(SampleMachine.Tag_手动吸盘);
             CupBlow.DataContext = plc.GetListenReg(SampleMachine.Tag_手动吹气);

+ 1 - 0
SCADA_DAQ/Customer/Views/Uct/UctSetAxisGroupParameter.xaml.cs

@@ -29,6 +29,7 @@ namespace SCADA_DAQ.Customer.Views.Uct
         public UctSetAxisGroupParameter()
         {
             InitializeComponent();
+            if (IsInDesignMode) return;
             plc = MachineServer.GetInstance().GetMachine<SampleMachine>("Device1");
             XOriginSwitch.DataContext = plc.GetListenReg(SampleMachine.Tag_开启设定X轴取放料点);
             XTake.DataContext = plc.GetListenReg(SampleMachine.Tag_设定X轴取料点);

+ 1 - 0
SCADA_DAQ/Customer/Views/Uct/UctSetSpeed.xaml.cs

@@ -29,6 +29,7 @@ namespace SCADA_DAQ.Customer.Views.Uct
         public UctSetSpeed()
         {
             InitializeComponent();
+            if (IsInDesignMode) return;
             plc = MachineServer.GetInstance().GetMachine<SampleMachine>("Device1");
 
             string[] manualSetting = new string[]

+ 2 - 2
SCADA_DAQ/Customer/Views/Uct/UctShowItem.xaml

@@ -12,8 +12,8 @@
 
     <Grid>
         <StackPanel Orientation="Horizontal">
-            <TextBlock Text="{Binding Title,ElementName=this}" FontSize="30" FontWeight="Bold" Margin="5,0"/>
-            <TextBlock Text="{Binding ScaleValue,StringFormat={}{0}mm}" FontSize="30" FontWeight="Bold" Margin="5,0" Foreground="Green"/>
+            <TextBlock Text="{Binding Title,ElementName=this}" FontSize="22"  Margin="5,0"/>
+            <TextBlock Text="{Binding ScaleValue,StringFormat={}{0}mm}" FontSize="22" FontWeight="Bold" Margin="5,0" Foreground="Green"/>
         </StackPanel>
     </Grid>
 </wpfcontrol:BaseUserControl>

+ 1 - 1
SCADA_DAQ/Env.cs

@@ -84,7 +84,7 @@ namespace SCADA_DAQ
                             {
                                 ResourceName="AlarmDB",
                                 DBType = DatabaseType.Sqlite,
-                                FilePath = @"Data\Aalarmdb.db"
+                                FilePath = @"Data\Alarmdb.db"
                             },
                             new DataBaseConfig()
                             {

+ 13 - 0
SCADA_DAQ/LocalResource.Designer.cs

@@ -79,5 +79,18 @@ namespace SCADA_DAQ {
                 return ((byte[])(obj));
             }
         }
+
+
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] Alarmdb
+        {
+            get
+            {
+                object obj = ResourceManager.GetObject("Alarmdb", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
     }
 }

+ 3 - 0
SCADA_DAQ/LocalResource.resx

@@ -124,4 +124,7 @@
   <data name="Platform" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>Data\Platform.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
+  <data name="Alarmdb" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>Data\Alarmdb.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
 </root>

+ 6 - 0
SCADA_DAQ/SCADA_DAQ.csproj.user

@@ -5,6 +5,9 @@
     <Compile Update="Customer\UctFrmMain.xaml.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Update="Customer\UctFrmManual.xaml.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Update="Customer\UctFrmPalletizingManual.xaml.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -37,6 +40,9 @@
     <Page Update="Customer\UctFrmMain.xaml">
       <SubType>Designer</SubType>
     </Page>
+    <Page Update="Customer\UctFrmManual.xaml">
+      <SubType>Designer</SubType>
+    </Page>
     <Page Update="Customer\UctFrmPalletizingManual.xaml">
       <SubType>Designer</SubType>
     </Page>