Bläddra i källkod

开料分拣增加筛选小板逻辑

陈子杰 3 månader sedan
förälder
incheckning
dad68a0af1

+ 40 - 2
SCADA_DAQ/Customer/Machines/SortMachine.cs

@@ -1,5 +1,6 @@
 
 using Microsoft.DwayneNeed.Shapes;
+using Mysqlx.Session;
 using Newtonsoft.Json;
 using NPOI.POIFS.Crypt.Dsig.Facets;
 using NPOI.SS.Formula.Functions;
@@ -227,6 +228,8 @@ namespace SCADA_DAQ.Customer.Machines
                     {
                         _Lbls = GetLabes(CustomerEnv.SortingMacConfigValue.CycFilePath);
                         Labels = new ObservableCollection<LabelModel>(_Lbls);
+                        ExistSmallBoard();
+
                     }
                     else
                     {
@@ -244,10 +247,11 @@ namespace SCADA_DAQ.Customer.Machines
                             CuttingMac.READ_plc_register(7200, 7240, out ncName);
                             var path = CycFilePath(ncName);
                             CuttingMac.WRITE_plc_register(7200, 7240, new int[41]);
-                            if (path != null)
+                            if (File.Exists(path))
                             {
                                 _Lbls = GetLabes(path);
                                 Labels = new ObservableCollection<LabelModel>(_Lbls);
+                                ExistSmallBoard();
                             }
                             else
                             {
@@ -407,6 +411,8 @@ namespace SCADA_DAQ.Customer.Machines
                     {
                         System.Threading.Thread.Sleep(1000);
                         GetListenReg(Tag_SortFinish).SetBit();
+
+
                     }
                     CurrentLabel.Status = Models.TaskStatus.Excuting;
 
@@ -439,7 +445,7 @@ namespace SCADA_DAQ.Customer.Machines
                                 log.Info($"相机计算的偏差值为:X={_lbl.X},Y={_lbl.Y},R={_lbl.R}");
                                 _lbl.X += CustomerEnv.SortingMacConfigValue.XCameraOffset;
                             }
-                            else
+                            else 
                             {
                                 if (MessageBox.Show("连接相机失败,是否继续执行?", "相机数据", MessageBoxButton.YesNo) == MessageBoxResult.No)
                                 {
@@ -540,6 +546,8 @@ namespace SCADA_DAQ.Customer.Machines
                             //{
                             //    releaseXOffset -= 200;
                             //}
+                            //都放在输送辊中心点,无需偏移
+                            BoardInfo.ReleaseY = 0;
                             GetListenReg(Tag_CaptureX).WriteObject(null,
                             moveX + (float)xOffset,  //D1512
                             moveY + (float)yOffset,  //D1514
@@ -573,6 +581,17 @@ namespace SCADA_DAQ.Customer.Machines
 
                 //}
             }
+            else if (reg.Comment.Variable == Tag_LastBoardPutOK && reg.Value == 1)
+            {
+                if (GetListenReg(Tag_SmallBoardManualConfirm).Value == 1)
+                {
+                    if (MessageBox.Show("存在小板,请人工取走后点击确认按钮") == MessageBoxResult.OK)
+                    {
+                        GetListenReg(Tag_SmallBoardManualConfirm).ResetBit();
+                    }
+                }
+                reg.ResetBit();
+            }
         }
 
         /// <summary>
@@ -629,6 +648,25 @@ namespace SCADA_DAQ.Customer.Machines
             return CustomerEnv.SortingMacConfigValue.CycFolder + $@"\{fileName}";
         }
 
+        public void ExistSmallBoard()
+        {
+            var smallBoard = Labels.Where(t => Math.Min(t.ActualWidth, t.ActualLength) <= 80 ||
+                                                                Math.Max(t.ActualWidth, t.ActualLength) <= 250).ToList();
+            if (smallBoard != null && smallBoard.Count > 0)
+            {
+                foreach (var t in smallBoard)
+                {
+                    t.Status = Models.TaskStatus.Finished;
+                }
+                GetListenReg(Tag_SmallBoardManualConfirm).SetBit();
+            }
+            else
+            {
+                GetListenReg(Tag_SmallBoardManualConfirm).ResetBit();
+
+            }
+        }
+
         /// <summary>
         /// 
         /// </summary>

+ 5 - 3
SCADA_DAQ/Customer/Views/Menu/UctFrmSorting/UctFrmSortingMain.xaml

@@ -74,7 +74,7 @@
                             <Style TargetType="wpfcontrol:IconButton">
                                 <Setter Property="ButtonStyle" Value="Info"/>
                                 <Setter Property="Width" Value="200"/>
-                                <Setter Property="Height" Value="50"/>
+                                <Setter Property="Height" Value="40"/>
                                 <Setter Property="Margin" Value="5"/>
                                 <Setter Property="FontSize" Value="24"/>
                                 <Setter Property="FontWeight" Value="Bold"/>
@@ -112,13 +112,15 @@
                             </wpfcontrol:IconButton>
                             <wpfcontrol:IconButton Title="重新启动" ButtonKind="ReloadButton" Click="IconButton_Click" x:Name="RestartBtn">
                             </wpfcontrol:IconButton>
+                            <wpfcontrol:IconButton Title="一键送料" ButtonKind="RigthButton" Click="FeedBtn_Click"  x:Name="FeedBtn">
+                            </wpfcontrol:IconButton>
                             <wpfcontrol:IconButton ButtonKind="PauseButton" x:Name="PauseBtn" Click="PauseBtn_Click">
                                 <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="Height" Value="40"/>
                                         <Setter Property="Margin" Value="5"/>
                                         <Setter Property="FontSize" Value="24"/>
                                         <Setter Property="FontWeight" Value="Bold"/>
@@ -139,7 +141,7 @@
                                         <Setter Property="Title" Value="视觉已启用"/>
                                         <Setter Property="ButtonStyle" Value="Info"/>
                                         <Setter Property="Width" Value="200"/>
-                                        <Setter Property="Height" Value="50"/>
+                                        <Setter Property="Height" Value="40"/>
                                         <Setter Property="Margin" Value="5"/>
                                         <Setter Property="FontSize" Value="24"/>
                                         <Setter Property="FontWeight" Value="Bold"/>

+ 13 - 1
SCADA_DAQ/Customer/Views/Menu/UctFrmSorting/UctFrmSortingMain.xaml.cs

@@ -142,12 +142,13 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
 
                     ClearBtn.IsEnabled = true;
                     RestartBtn.IsEnabled = true;
+                    FeedBtn.IsEnabled = true;
                 }
                 else
                 {
                     ClearBtn.IsEnabled = false;
                     RestartBtn.IsEnabled = false;
-
+                    FeedBtn.IsEnabled = false;
                 }
             });
         }
@@ -304,6 +305,17 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
         {
 
         }
+
+        private void FeedBtn_Click(object sender, RoutedEventArgs e)
+        {
+            plc.GetListenReg(SortMachine.Tag_StartSort).SetBit();
+            plc.GetListenReg(SortMachine.Tag_FeedBtn).SetBit();
+            Task.Run(() =>
+            {
+                Thread.Sleep(500);
+                plc.GetListenReg(SortMachine.Tag_ScrapsClear).WriteReg(1);
+            });
+        }
     }
 
     public class ActionPara : ObservableObject

+ 10 - 3
SCADA_DAQ/Machines/LongMen2_龙门移载2.cs

@@ -148,12 +148,12 @@ namespace SCADA_DAQ.Customer.Machines
 		/// </summary>
 		public const string @Tag_M19="M19";
 			
-		/// <summary>寄存器:M20【M20
+		/// <summary>寄存器:M116【Blocking
 		/// <para>单位:</para> 
 		/// <para>缩放:1 类型: Default</para> 
-		/// <para>备注:</para> 
+		/// <para>备注:堵料</para> 
 		/// </summary>
-		public const string @Tag_M20="M20";
+		public const string @Tag_Blocking="Blocking";
 			
 		/// <summary>寄存器:D100【WorkModel】
 		/// <para>单位:</para> 
@@ -162,6 +162,13 @@ namespace SCADA_DAQ.Customer.Machines
 		/// </summary>
 		public const string @Tag_WorkModel="WorkModel";
 			
+		/// <summary>寄存器:D176【RemoveNG】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:排除板完成</para> 
+		/// </summary>
+		public const string @Tag_RemoveNG="RemoveNG";
+			
 		/// <summary>寄存器:D101【D101】
 		/// <para>单位:</para> 
 		/// <para>缩放:1 类型: Default</para> 

+ 10 - 3
SCADA_DAQ/Machines/LongMen4_龙门移载4.cs

@@ -148,12 +148,12 @@ namespace SCADA_DAQ.Customer.Machines
 		/// </summary>
 		public const string @Tag_M19="M19";
 			
-		/// <summary>寄存器:M20【M20
+		/// <summary>寄存器:M117【Blocking
 		/// <para>单位:</para> 
 		/// <para>缩放:1 类型: Default</para> 
-		/// <para>备注:</para> 
+		/// <para>备注:堵料</para> 
 		/// </summary>
-		public const string @Tag_M20="M20";
+		public const string @Tag_Blocking="Blocking";
 			
 		/// <summary>寄存器:D100【WorkModel】
 		/// <para>单位:</para> 
@@ -162,6 +162,13 @@ namespace SCADA_DAQ.Customer.Machines
 		/// </summary>
 		public const string @Tag_WorkModel="WorkModel";
 			
+		/// <summary>寄存器:D177【RemoveNG】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:排除板完成</para> 
+		/// </summary>
+		public const string @Tag_RemoveNG="RemoveNG";
+			
 		/// <summary>寄存器:D114【Zero】
 		/// <para>单位:</para> 
 		/// <para>缩放:1 类型: Float</para> 

+ 89 - 0
SCADA_DAQ/Machines/SampleMachine_真封边机.cs

@@ -0,0 +1,89 @@
+using System;
+using SCADA.CommonLib;
+using SCADA.CommonLib.Data;
+using SCADA.CommonLib.Data.DIL.Sqlite;
+using SCADA.CommonLib.Data.DIL; 
+namespace SCADA_DAQ.Customer.Machines
+{
+	public partial class SampleMachine
+	{
+	
+		/// <summary>寄存器:D30【D30】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:通道</para> 
+		/// </summary>
+		public const string @Tag_D30="D30";
+			
+		/// <summary>寄存器:D31【D31】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:跟踪</para> 
+		/// </summary>
+		public const string @Tag_D31="D31";
+			
+		/// <summary>寄存器:D32【D32】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:厚度</para> 
+		/// </summary>
+		public const string @Tag_D32="D32";
+			
+		/// <summary>寄存器:D33【D33】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:</para> 
+		/// </summary>
+		public const string @Tag_D33="D33";
+			
+		/// <summary>寄存器:D34【D34】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:</para> 
+		/// </summary>
+		public const string @Tag_D34="D34";
+			
+		/// <summary>寄存器:D35【D35】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:</para> 
+		/// </summary>
+		public const string @Tag_D35="D35";
+			
+		/// <summary>寄存器:D36【D36】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:</para> 
+		/// </summary>
+		public const string @Tag_D36="D36";
+			
+		/// <summary>寄存器:D37【D37】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:</para> 
+		/// </summary>
+		public const string @Tag_D37="D37";
+			
+		/// <summary>寄存器:D38【D38】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:</para> 
+		/// </summary>
+		public const string @Tag_D38="D38";
+			
+		/// <summary>寄存器:D39【D39】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:</para> 
+		/// </summary>
+		public const string @Tag_D39="D39";
+			
+		/// <summary>寄存器:D40【D40】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:</para> 
+		/// </summary>
+		public const string @Tag_D40="D40";
+						
+	}
+}

+ 21 - 0
SCADA_DAQ/Machines/SortMachine_分拣机.cs

@@ -1260,6 +1260,27 @@ namespace SCADA_DAQ.Customer.Machines
 		/// <para>备注:单机时解析文件</para> 
 		/// </summary>
 		public const string @Tag_SingleModeSort="SingleModeSort";
+			
+		/// <summary>寄存器:M1020【SmallBoardManualConfirm】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:小板人工确认</para> 
+		/// </summary>
+		public const string @Tag_SmallBoardManualConfirm="SmallBoardManualConfirm";
+			
+		/// <summary>寄存器:M1021【FeedBtn】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:一键送料</para> 
+		/// </summary>
+		public const string @Tag_FeedBtn="FeedBtn";
+			
+		/// <summary>寄存器:M1022【LastBoardPutOK】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:最后一张板放板完成</para> 
+		/// </summary>
+		public const string @Tag_LastBoardPutOK="LastBoardPutOK";
 						
 	}
 }