2 Commits 2c5736146e ... bd471894ec

Autore SHA1 Messaggio Data
  陈子杰 bd471894ec 完善逻辑 3 mesi fa
  陈子杰 dad68a0af1 开料分拣增加筛选小板逻辑 3 mesi fa

+ 366 - 0
SCADA_DAQ.DAL/DBSchema.cs

@@ -1935,6 +1935,85 @@ public static class T_Col_Name
                 /// </summary>
                  public const string @Remark_Str=nameof(@Remark_Str);
                     
+             }
+             /// <summary> 
+             /// App_Hold_SortingLabels
+             /// </summary>
+             public class App_Hold_SortingLabels
+             {
+             	/// <summary>
+                /// 
+                /// </summary>
+                 public const string @ID=nameof(@ID);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @LabelName_Str=nameof(@LabelName_Str);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @X_Dec=nameof(@X_Dec);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Y_Dec=nameof(@Y_Dec);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @R_Dec=nameof(@R_Dec);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @CodeID_Str=nameof(@CodeID_Str);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @PositionX_Dec=nameof(@PositionX_Dec);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @PositionY_Dec=nameof(@PositionY_Dec);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @ActualLength_Dec=nameof(@ActualLength_Dec);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @ActualWidth_Dec=nameof(@ActualWidth_Dec);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Waste_Dec=nameof(@Waste_Dec);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Accurate_Dec=nameof(@Accurate_Dec);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Status_Int=nameof(@Status_Int);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @CreateUser_Str=nameof(@CreateUser_Str);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @CreateTime_Dt=nameof(@CreateTime_Dt);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @ModifyTime_Dt=nameof(@ModifyTime_Dt);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @ModifyUser_Str=nameof(@ModifyUser_Str);
+                    /// <summary>
+                /// 
+                /// </summary>
+                 public const string @Remark_Str=nameof(@Remark_Str);
+                    
              }
              
                           }
@@ -9049,6 +9128,283 @@ namespace DBModel
                 }
             }
             
+             }
+             /// <summary> 
+             /// 
+             /// </summary>
+             public class App_Hold_SortingLabels:ObservableObject
+             {
+             	  private System.Int64 _ID;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Int64 ID
+                {
+                get {return _ID;}
+                set{
+                    if(value!=(_ID))
+                    {
+                        _ID=value;
+                        OnPropertyChanged(nameof( ID));
+                    }
+                }
+            }
+              private System.String _LabelName_Str;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.String LabelName_Str
+                {
+                get {return _LabelName_Str;}
+                set{
+                    if(value!=(_LabelName_Str))
+                    {
+                        _LabelName_Str=value;
+                        OnPropertyChanged(nameof( LabelName_Str));
+                    }
+                }
+            }
+              private System.Decimal _X_Dec;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Decimal X_Dec
+                {
+                get {return _X_Dec;}
+                set{
+                    if(value!=(_X_Dec))
+                    {
+                        _X_Dec=value;
+                        OnPropertyChanged(nameof( X_Dec));
+                    }
+                }
+            }
+              private System.Decimal _Y_Dec;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Decimal Y_Dec
+                {
+                get {return _Y_Dec;}
+                set{
+                    if(value!=(_Y_Dec))
+                    {
+                        _Y_Dec=value;
+                        OnPropertyChanged(nameof( Y_Dec));
+                    }
+                }
+            }
+              private System.Decimal _R_Dec;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Decimal R_Dec
+                {
+                get {return _R_Dec;}
+                set{
+                    if(value!=(_R_Dec))
+                    {
+                        _R_Dec=value;
+                        OnPropertyChanged(nameof( R_Dec));
+                    }
+                }
+            }
+              private System.String _CodeID_Str;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.String CodeID_Str
+                {
+                get {return _CodeID_Str;}
+                set{
+                    if(value!=(_CodeID_Str))
+                    {
+                        _CodeID_Str=value;
+                        OnPropertyChanged(nameof( CodeID_Str));
+                    }
+                }
+            }
+              private System.Decimal _PositionX_Dec;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Decimal PositionX_Dec
+                {
+                get {return _PositionX_Dec;}
+                set{
+                    if(value!=(_PositionX_Dec))
+                    {
+                        _PositionX_Dec=value;
+                        OnPropertyChanged(nameof( PositionX_Dec));
+                    }
+                }
+            }
+              private System.Decimal _PositionY_Dec;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Decimal PositionY_Dec
+                {
+                get {return _PositionY_Dec;}
+                set{
+                    if(value!=(_PositionY_Dec))
+                    {
+                        _PositionY_Dec=value;
+                        OnPropertyChanged(nameof( PositionY_Dec));
+                    }
+                }
+            }
+              private System.Decimal _ActualLength_Dec;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Decimal ActualLength_Dec
+                {
+                get {return _ActualLength_Dec;}
+                set{
+                    if(value!=(_ActualLength_Dec))
+                    {
+                        _ActualLength_Dec=value;
+                        OnPropertyChanged(nameof( ActualLength_Dec));
+                    }
+                }
+            }
+              private System.Decimal _ActualWidth_Dec;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Decimal ActualWidth_Dec
+                {
+                get {return _ActualWidth_Dec;}
+                set{
+                    if(value!=(_ActualWidth_Dec))
+                    {
+                        _ActualWidth_Dec=value;
+                        OnPropertyChanged(nameof( ActualWidth_Dec));
+                    }
+                }
+            }
+              private System.Decimal _Waste_Dec;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Decimal Waste_Dec
+                {
+                get {return _Waste_Dec;}
+                set{
+                    if(value!=(_Waste_Dec))
+                    {
+                        _Waste_Dec=value;
+                        OnPropertyChanged(nameof( Waste_Dec));
+                    }
+                }
+            }
+              private System.Decimal _Accurate_Dec;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Decimal Accurate_Dec
+                {
+                get {return _Accurate_Dec;}
+                set{
+                    if(value!=(_Accurate_Dec))
+                    {
+                        _Accurate_Dec=value;
+                        OnPropertyChanged(nameof( Accurate_Dec));
+                    }
+                }
+            }
+              private System.Int32 _Status_Int;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.Int32 Status_Int
+                {
+                get {return _Status_Int;}
+                set{
+                    if(value!=(_Status_Int))
+                    {
+                        _Status_Int=value;
+                        OnPropertyChanged(nameof( Status_Int));
+                    }
+                }
+            }
+              private System.String _CreateUser_Str;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.String CreateUser_Str
+                {
+                get {return _CreateUser_Str;}
+                set{
+                    if(value!=(_CreateUser_Str))
+                    {
+                        _CreateUser_Str=value;
+                        OnPropertyChanged(nameof( CreateUser_Str));
+                    }
+                }
+            }
+              private System.DateTime _CreateTime_Dt;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.DateTime CreateTime_Dt
+                {
+                get {return _CreateTime_Dt;}
+                set{
+                    if(value!=(_CreateTime_Dt))
+                    {
+                        _CreateTime_Dt=value;
+                        OnPropertyChanged(nameof( CreateTime_Dt));
+                    }
+                }
+            }
+              private System.DateTime _ModifyTime_Dt;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.DateTime ModifyTime_Dt
+                {
+                get {return _ModifyTime_Dt;}
+                set{
+                    if(value!=(_ModifyTime_Dt))
+                    {
+                        _ModifyTime_Dt=value;
+                        OnPropertyChanged(nameof( ModifyTime_Dt));
+                    }
+                }
+            }
+              private System.String _ModifyUser_Str;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.String ModifyUser_Str
+                {
+                get {return _ModifyUser_Str;}
+                set{
+                    if(value!=(_ModifyUser_Str))
+                    {
+                        _ModifyUser_Str=value;
+                        OnPropertyChanged(nameof( ModifyUser_Str));
+                    }
+                }
+            }
+              private System.String _Remark_Str;
+                /// <summary>
+                /// 
+                /// </summary>
+                 public System.String Remark_Str
+                {
+                get {return _Remark_Str;}
+                set{
+                    if(value!=(_Remark_Str))
+                    {
+                        _Remark_Str=value;
+                        OnPropertyChanged(nameof( Remark_Str));
+                    }
+                }
+            }
+            
              }
              /// <summary> 
              /// 
@@ -11118,6 +11474,10 @@ public BaseTable App_Hold_BoardInfo{get;private set;}
  /// <summary> 
  ///  
  /// </summary> 
+public BaseTable App_Hold_SortingLabels{get;private set;}
+ /// <summary> 
+ ///  
+ /// </summary> 
 public BaseTable V_Sys_F_UserRole{get;private set;}
  /// <summary> 
  ///  
@@ -11178,6 +11538,7 @@ Sys_Menu_Info=CreateTable("ID","Sys_Menu_Info");
 App_Onduty=CreateTable("ID","App_Onduty");
 App_LocalNodeManage=CreateTable("ID","App_LocalNodeManage");
 App_Hold_BoardInfo=CreateTable("ID","App_Hold_BoardInfo");
+App_Hold_SortingLabels=CreateTable("ID","App_Hold_SortingLabels");
 V_Sys_F_UserRole=CreateTable("ID","V_Sys_F_UserRole");
 V_User_D_UserInfo=CreateTable("ID","V_User_D_UserInfo");
 V_Base_AlarmLog=CreateTable("ID","V_Base_AlarmLog");
@@ -11326,6 +11687,10 @@ public BaseTable App_Hold_BoardInfo{get;private set;}
  /// <summary> 
  ///  
  /// </summary> 
+public BaseTable App_Hold_SortingLabels{get;private set;}
+ /// <summary> 
+ ///  
+ /// </summary> 
 public BaseTable V_Sys_F_UserRole{get;private set;}
  /// <summary> 
  ///  
@@ -11392,6 +11757,7 @@ Sys_Menu_Info=innerDb.CreateTable("ID","Sys_Menu_Info");
 App_Onduty=innerDb.CreateTable("ID","App_Onduty");
 App_LocalNodeManage=innerDb.CreateTable("ID","App_LocalNodeManage");
 App_Hold_BoardInfo=innerDb.CreateTable("ID","App_Hold_BoardInfo");
+App_Hold_SortingLabels=innerDb.CreateTable("ID","App_Hold_SortingLabels");
 V_Sys_F_UserRole=innerDb.CreateTable("ID","V_Sys_F_UserRole");
 V_User_D_UserInfo=innerDb.CreateTable("ID","V_User_D_UserInfo");
 V_Base_AlarmLog=innerDb.CreateTable("ID","V_Base_AlarmLog");

+ 1 - 0
SCADA_DAQ/Customer/CustomerEnv.cs

@@ -42,5 +42,6 @@ namespace SCADA_DAQ.Customer
             });
 
         public static SortingMacSettingModel SortingMacConfigValue { get => _SortingConfig.Value; }
+
     }
 }

+ 231 - 53
SCADA_DAQ/Customer/Machines/SortMachine.cs

@@ -1,11 +1,16 @@
 
+using DBNames;
+using LiveCharts.Defaults;
 using Microsoft.DwayneNeed.Shapes;
+using Mysqlx.Session;
 using Newtonsoft.Json;
 using NPOI.POIFS.Crypt.Dsig.Facets;
 using NPOI.SS.Formula.Functions;
 using NPOI.XWPF.UserModel;
 using Opc.Ua;
 using SCADA.BarcodeReader;
+using SCADA.CommonLib;
+using SCADA.CommonLib.Data.DIL;
 using SCADA.CommonLib.Helper;
 using SCADA.Drive;
 using SCADA_DAQ.Customer.Models;
@@ -24,6 +29,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Ink;
+using System.Windows.Shapes;
 using System.Xml.Linq;
 
 namespace SCADA_DAQ.Customer.Machines
@@ -51,6 +57,26 @@ namespace SCADA_DAQ.Customer.Machines
 
             //}
             CuttingMac = new SyntecRemoteCNC(CustomerEnv.SortingMacConfigValue.CuttingMacIP);
+            _Lbls = Env.DAL.App_Hold_SortingLabels.GetData<LabelModel>().ToList();           
+            Labels = new ObservableCollection<LabelModel>(_Lbls);
+            CurrentCycDoc = CustomerEnv.SortingMacConfigValue.CurrentFileName;
+            //var str = "{ \"X\" : [],\"Y\":[],\"R\":[],\"ID\":\"\"}";
+            //var labels = JsonHelper.JsonDeserialize<CameraModels>(str);
+            //var codes = labels.ID.Split(',');
+            //var labelModels = new List<LabelModel>();
+            //for (int i = 0; i < codes.Count(); i++)
+            //{
+            //    labelModels.Add(new LabelModel { X = labels.X[i], Y = labels.Y[i], R = labels.R[i], CodeID = codes[i] });
+            //}
+            //var model = labelModels.Where(x => x.CodeID == "5151").FirstOrDefault();
+            //if (model != null)
+            //{
+
+            //}
+            //else
+            //{
+
+            //}
             //var str = CycFilePath(6378049);
         }
 
@@ -71,8 +97,8 @@ namespace SCADA_DAQ.Customer.Machines
         }
         private ObservableCollection<LabelModel> _Labels;
         private List<LabelModel> _Lbls;
-        private double CenterX {  get; set; }   
-        private double CenterY { get; set; }    
+        private double CenterX { get; set; }
+        private double CenterY { get; set; }
 
         ///// <summary>
         ///// 文件选择
@@ -212,8 +238,8 @@ namespace SCADA_DAQ.Customer.Machines
 
             var reg = (RegInfo)sender;
 
-            
-            
+
+
             if (reg.Comment.Variable == Tag_StartSort && reg.Value == 1)
             {
                 //_Lbls = GetLabes(File.FilePath);
@@ -225,14 +251,16 @@ namespace SCADA_DAQ.Customer.Machines
                     end = true;
                     if (CustomerEnv.SortingMacConfigValue.CycFilePath != null)
                     {
-                        _Lbls = GetLabes(CustomerEnv.SortingMacConfigValue.CycFilePath);
-                        Labels = new ObservableCollection<LabelModel>(_Lbls);
+
+
+                        ExistSmallBoard(CustomerEnv.SortingMacConfigValue.CycFilePath);
+
                     }
                     else
                     {
                         MessageBox.Show($"参数页面中的'单机运行时cyc文件'为空!");
                     }
-                    
+
                 }
                 else
                 {
@@ -243,11 +271,10 @@ namespace SCADA_DAQ.Customer.Machines
                             var ncName = new int[41];
                             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);
+                                CuttingMac.WRITE_plc_register(7200, 7240, new int[41]);
+                                ExistSmallBoard(path);
                             }
                             else
                             {
@@ -277,8 +304,8 @@ namespace SCADA_DAQ.Customer.Machines
                         }
                     }
                 }
-                
-                reg.ResetBit(); 
+
+                reg.ResetBit();
                 NewBoardArrived?.Invoke(this, EventArgs.Empty);
             }
             else if (reg.Comment.Variable == Tag_RequestNext && reg.Value == 1 && reg.OldValue == 0)
@@ -299,7 +326,7 @@ namespace SCADA_DAQ.Customer.Machines
                     //var Cup1Center = new Point(-140, -155);
                     //var Cup3Center = new Point(135, -155);
                     //修改后
-                    
+
 
                     if ((CurrentLabel.ActualLength > 550 && CurrentLabel.ActualWidth > 200) ||
                         (CurrentLabel.ActualWidth > 550 && CurrentLabel.ActualLength > 200)
@@ -349,7 +376,7 @@ namespace SCADA_DAQ.Customer.Machines
                             else
                             {
                                 BoardInfo.Rotation = 90;
-                                var cup1NewCenter = new Point(Cup1Center.Y,-1 * (double)Cup1Center.X);  //旋转后的坐标
+                                var cup1NewCenter = new Point(Cup1Center.Y, -1 * (double)Cup1Center.X);  //旋转后的坐标
                                 CupNewCenter = cup1NewCenter;
                                 //cup3NewCenter.Offset(100, 32.5);   //补偿夹具尺寸
                                 BoardInfo.CupCenter = new Point(BoardInfo.CupCenter.X - cup1NewCenter.X, BoardInfo.CupCenter.Y - cup1NewCenter.Y);
@@ -368,7 +395,7 @@ namespace SCADA_DAQ.Customer.Machines
                                 if (CurrentLabel.ActualLength < CurrentLabel.ActualWidth)
                                 {
                                     BoardInfo.Rotation = -90;
-                                    var cup3NewCenter = new Point(Cup3Center.Y * -1,(double)Cup3Center.X);  //旋转后的坐标
+                                    var cup3NewCenter = new Point(Cup3Center.Y * -1, (double)Cup3Center.X);  //旋转后的坐标
                                     BoardInfo.CupCenter = new Point(BoardInfo.CupCenter.X - cup3NewCenter.X, BoardInfo.CupCenter.Y - cup3NewCenter.Y);
                                     CupNewCenter = cup3NewCenter;
 
@@ -399,28 +426,31 @@ namespace SCADA_DAQ.Customer.Machines
 
                     }
 
-                    GetListenReg(Tag_PhotoAngle).WriteObject(null,(float)BoardInfo.Rotation);
+                    GetListenReg(Tag_PhotoAngle).WriteObject(null, (float)BoardInfo.Rotation);
                     GetListenReg(Tag_PhotographX).WriteObject(null,
                     (float)(CurrentLabel.X > originXOffset ? CurrentLabel.X - originXOffset : 0),
                     (float)(CurrentLabel.Y - cameraOriginy), (short)1);
-                    if (CurrentLabel == _Lbls.Where(t=>t.Status == Models.TaskStatus.None).Last())
+                    if (CurrentLabel == _Lbls.Where(t => t.Status == Models.TaskStatus.None).Last())
                     {
                         System.Threading.Thread.Sleep(1000);
                         GetListenReg(Tag_SortFinish).SetBit();
+
+
                     }
                     CurrentLabel.Status = Models.TaskStatus.Excuting;
-
+                    Env.DAL.App_Hold_SortingLabels.Update($"{T_Col_Name.App_Hold_SortingLabels.CodeID_Str} = '{CurrentLabel.CodeID}'",
+                        new UpdateItem(T_Col_Name.App_Hold_SortingLabels.Status_Int, (int)Models.TaskStatus.Excuting));
                 }
                 else
                 {
-                    MessageBox.Show("板件已经分拣完成!!!"); 
+                    MessageBox.Show("板件已经分拣完成!!!");
                 }
 
                 reg.ResetBit();
             }
             else if (reg.Comment.Variable == Tag_CameraMoveOK && reg.Value == 1 && reg.OldValue == 0)
-            { 
-                //var _lbl = new LabelModel() { ID = CurrentLabel.ID };
+            {
+                //var _lbl = new LabelModel() { CodeID = CurrentLabel.CodeID };
                 var _lbl = new LabelModel();
                 var isCancel = false;
                 if (GetListenReg(Tag_CameraEnable).Value == 0)
@@ -435,9 +465,36 @@ namespace SCADA_DAQ.Customer.Machines
                            new SCADA.Comm.ResponseInfo(SCADA.Comm.ResponseType.EndFlag) { EndFlags = new byte[] { 0x0A } });
                             if (_strContent != null)
                             {
-                                _lbl = JsonHelper.JsonDeserialize<LabelModel>(_strContent);  //获取标签位置
-                                log.Info($"相机计算的偏差值为:X={_lbl.X},Y={_lbl.Y},R={_lbl.R}");
-                                _lbl.X += CustomerEnv.SortingMacConfigValue.XCameraOffset;
+                                //var labels = new List<LabelModel>();
+
+                                var labels = JsonHelper.JsonDeserialize<CameraModels>(_strContent);  //获取标签位置
+                                var codes = labels.ID.Split(',');
+                                var labelModels = new List<LabelModel>();
+                                for (int i = 0; i < codes.Count(); i++)
+                                {
+                                    labelModels.Add(new LabelModel { X = labels.X[i], Y = labels.Y[i], R = labels.R[i], CodeID = codes[i] });
+                                }
+                                _lbl = labelModels.Where(t => t.CodeID == CurrentLabel.CodeID).FirstOrDefault();
+                                if (_lbl != null)
+                                {
+                                    log.Info($"相机计算的偏差值为:X={_lbl.X},Y={_lbl.Y},R={_lbl.R}");
+                                    _lbl.X += CustomerEnv.SortingMacConfigValue.XCameraOffset;
+                                }
+                                else
+                                {
+                                    _lbl = new LabelModel { CodeID = CurrentLabel.CodeID };
+
+                                    if (!CustomerEnv.SortingMacConfigValue.IsCameraFailForceRun)
+                                    {
+                                        if (MessageBox.Show($"相机数据中没有识别到数据 \n 是否继续?", "相机数据", MessageBoxButton.YesNo) == MessageBoxResult.No)
+                                        {
+                                            isCancel = true;
+                                            CurrentLabel.Status = Models.TaskStatus.None;
+                                            GetListenReg(Tag_Reset).SetBit();
+                                        }
+                                    }
+                                }
+
                             }
                             else
                             {
@@ -449,7 +506,7 @@ namespace SCADA_DAQ.Customer.Machines
                                 }
                                 else
                                 {
-                                    _lbl.ID = CurrentLabel.ID;
+                                    _lbl.CodeID = CurrentLabel.CodeID;
 
                                 }
                             }
@@ -457,42 +514,39 @@ namespace SCADA_DAQ.Customer.Machines
                         }
                         catch (Exception ex)
                         {
+                            //var path = ((JsonReaderException)ex).Path;
+                            _lbl.CodeID = CurrentLabel.CodeID;
 
-                            if (ex.Source == "Newtonsoft.Json")
+                            if (!CustomerEnv.SortingMacConfigValue.IsCameraFailForceRun)
                             {
-                                var path = ((JsonReaderException)ex).Path;
-                                _lbl.ID = CurrentLabel.ID;
-
-                                if (!CustomerEnv.SortingMacConfigValue.IsCameraFailForceRun)
+                                if (MessageBox.Show($"相机数据中没有识别到数据 \n 是否继续?", "相机数据", MessageBoxButton.YesNo) == MessageBoxResult.No)
                                 {
-                                    if (MessageBox.Show($"相机数据中属性“{path}”数据错误 \n 是否继续?", "相机数据", MessageBoxButton.YesNo) == MessageBoxResult.No)
-                                    {
-                                        isCancel = true;
-                                        CurrentLabel.Status = Models.TaskStatus.None;
-                                        GetListenReg(Tag_Reset).SetBit();
-                                    }
+                                    isCancel = true;
+                                    CurrentLabel.Status = Models.TaskStatus.None;
+                                    GetListenReg(Tag_Reset).SetBit();
                                 }
-                                
                             }
 
 
+
+
                         }
 
                     }
                 }
                 else
                 {
-                    _lbl.ID = CurrentLabel.ID;
+                    _lbl.CodeID = CurrentLabel.CodeID;
                 }
                 if (!isCancel)
                 {
-                    if (_lbl.ID == CurrentLabel.ID)
+                    if (_lbl.CodeID == CurrentLabel.CodeID)
                     {
-                        Log.Info($"开始处理,{CurrentLabel.ID}");
-                        
+                        Log.Info($"开始处理,{CurrentLabel.CodeID}");
+
                         var rotation = BoardInfo.Rotation;
-                        var releaseRotation = rotation  == 0 ? -90  : rotation;
-                        
+                        var releaseRotation = rotation == 0 ? -90 : rotation;
+
                         var releaseXOffset = 0f;
                         if (BoardInfo.CupIndex != 2)
                         {
@@ -504,7 +558,15 @@ namespace SCADA_DAQ.Customer.Machines
                         //    releaseRotation = -90;
                         //}
                         BoardInfo.ReleaseY = Math.Max(10, BoardInfo.ReleaseY);
-                        rotation += _lbl.R;
+                        if (CurrentLabel.R == 90)
+                        {
+                            rotation += Math.Abs(_lbl.R) - CurrentLabel.R;
+                        }
+                        else
+                        {
+                            rotation += _lbl.R - CurrentLabel.R;
+
+                        }
 
                         var moveX = (float)((double)_lbl.X + BoardInfo.CupCenter.X);
                         moveX = moveX > originXOffset ? moveX - originXOffset : 0;
@@ -526,7 +588,7 @@ namespace SCADA_DAQ.Customer.Machines
                             xOffset = CupNewCenter.X - (CupNewCenter.X * Math.Cos(angle) - CupNewCenter.Y * Math.Sin(angle));
                             yOffset = CupNewCenter.Y - (CupNewCenter.X * Math.Sin(angle) + CupNewCenter.Y * Math.Cos(angle));
                         }
-                        
+
 
                         //var xoffset = Math.Sin(a) * (double)CurrentLabel.ActualLength;
                         //var yoffset = Math.Sin(angle) * (double)CurrentLabel.ActualWidth;
@@ -540,6 +602,8 @@ namespace SCADA_DAQ.Customer.Machines
                             //{
                             //    releaseXOffset -= 200;
                             //}
+                            //都放在输送辊中心点,无需偏移
+                            BoardInfo.ReleaseY = 0;
                             GetListenReg(Tag_CaptureX).WriteObject(null,
                             moveX + (float)xOffset,  //D1512
                             moveY + (float)yOffset,  //D1514
@@ -551,10 +615,10 @@ namespace SCADA_DAQ.Customer.Machines
                             (float)BoardInfo.ReleaseY,  // D1524 放板位置Y
                             (float)releaseRotation          //放板角度
                             );
-                            
+
                             CupMove?.Invoke(this, new CupMoveEventArgs() { X = (double)_lbl.X + BoardInfo.CupCenter.X, Y = (double)_lbl.Y + BoardInfo.CupCenter.Y, R = (double)rotation, CupIndex = BoardInfo.CupIndex });
 
-                            Log.Info($"正在分拣:{CurrentLabel.ID},X:{moveX},Y:{moveY},角度:{rotation},吸盘:{BoardInfo.CupIndex}");
+                            Log.Info($"正在分拣:{CurrentLabel.CodeID},X:{moveX},Y:{moveY},角度:{rotation},吸盘:{BoardInfo.CupIndex}");
                         }
                         else
                         {
@@ -563,7 +627,7 @@ namespace SCADA_DAQ.Customer.Machines
                     }
                     else
                     {
-                        Log.Error($"拍照获取的ID与需求ID不一致,被拍照的ID:{_lbl.ID},需求的板材ID:{CurrentLabel.ID}");
+                        Log.Error($"拍照获取的ID与需求ID不一致,被拍照的ID:{_lbl.CodeID},需求的板材ID:{CurrentLabel.CodeID}");
                     }
                 }
                 else
@@ -573,6 +637,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>
@@ -609,8 +684,8 @@ namespace SCADA_DAQ.Customer.Machines
             for (int i = 0; i < values.Count(); i++)
             {
                 code[0 + i * 4] = (byte)(values[i] >> 0);
-                code[1+ i * 4] = (byte)(values[i] >> 8);
-                code[2+ i * 4] = (byte)(values[i] >> 16);
+                code[1 + i * 4] = (byte)(values[i] >> 8);
+                code[2 + i * 4] = (byte)(values[i] >> 16);
                 code[3 + i * 4] = (byte)(values[i] >> 24);
             }
             for (int i = 0; i < code.Count(); i++)
@@ -623,12 +698,39 @@ namespace SCADA_DAQ.Customer.Machines
             }
             log.Info($"开料机解析的加工文件为{str}");
             //return str;
-            var fileName ="Label_"+str.Replace(".nc",".cyc");
+            var fileName = "Label_" + str.Replace(".nc", ".cyc");
             CurrentCycDoc = fileName;
+            CustomerEnv.SortingMacConfigValue.CurrentFileName = fileName;
             var filePath = new DirectoryInfo(CustomerEnv.SortingMacConfigValue.CycFolder).GetFiles().Where(t => t.Name.Contains(fileName)).FirstOrDefault();
             return CustomerEnv.SortingMacConfigValue.CycFolder + $@"\{fileName}";
         }
 
+        public void ExistSmallBoard(string path)
+        {
+            _Lbls = GetLabes(path);
+            Labels = new ObservableCollection<LabelModel>(_Lbls);
+            Env.DAL.App_Hold_SortingLabels.Delete("1=1");
+
+            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();
+
+            }
+            Env.DAL.Insert(_Lbls);
+        }
+
         /// <summary>
         /// 
         /// </summary>
@@ -656,6 +758,82 @@ namespace SCADA_DAQ.Customer.Machines
 
         }
 
-        
+
+    }
+
+    public class CameraModels : ObservableObject
+    {
+
+        /// <summary>
+        /// X集合
+        /// </summary>
+        public List<decimal> X
+        {
+            get { return _X; }
+            set
+            {
+                if (value != _X)
+                {
+                    _X = value;
+                    OnPropertyChanged(nameof(X));
+                }
+            }
+        }
+        private List<decimal> _X;
+
+
+        /// <summary>
+        /// Y集合
+        /// </summary>
+        public List<decimal> Y
+        {
+            get { return _Y; }
+            set
+            {
+                if (value != _Y)
+                {
+                    _Y = value;
+                    OnPropertyChanged(nameof(Y));
+                }
+            }
+        }
+        private List<decimal> _Y;
+
+
+        /// <summary>
+        /// R集合
+        /// </summary>
+        public List<decimal> R
+        {
+            get { return _R; }
+            set
+            {
+                if (value != _R)
+                {
+                    _R = value;
+                    OnPropertyChanged(nameof(R));
+                }
+            }
+        }
+        private List<decimal> _R;
+
+
+        /// <summary>
+        /// ID集合
+        /// </summary>
+        public string ID
+        {
+            get { return _ID; }
+            set
+            {
+                if (value != _ID)
+                {
+                    _ID = value;
+                    OnPropertyChanged(nameof(ID));
+                }
+            }
+        }
+        private string _ID;
+
     }
 }

+ 35 - 7
SCADA_DAQ/Customer/Models/LabelModel.cs

@@ -1,4 +1,5 @@
-using Newtonsoft.Json;
+using DBNames;
+using Newtonsoft.Json;
 using SCADA.CommonLib;
 using System;
 using System.Collections.Generic;
@@ -12,6 +13,8 @@ namespace SCADA_DAQ.Customer.Models
     /// <summary>
     /// 
     /// </summary>
+    /// 
+    [Table(nameof(DBModel.App_Hold_SortingLabels))]
     public class LabelModel : ObservableObject
     {
 
@@ -19,6 +22,7 @@ namespace SCADA_DAQ.Customer.Models
         /// 标签图片
         /// </summary>
         [AutoViewProperty("标签图片")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.LabelName_Str)]
         public string LabelName
         {
             get { return _LabelName; }
@@ -38,6 +42,8 @@ namespace SCADA_DAQ.Customer.Models
         /// 标签X坐标
         /// </summary>
         [AutoViewProperty("标签X坐标")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.X_Dec)]
+
         public decimal X
         {
             get { return _X; }
@@ -58,6 +64,8 @@ namespace SCADA_DAQ.Customer.Models
         /// 标签Y坐标
         /// </summary>
         [AutoViewProperty("标签Y坐标")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.Y_Dec)]
+
         public decimal Y
         {
             get { return _Y; }
@@ -78,6 +86,8 @@ namespace SCADA_DAQ.Customer.Models
         /// 标签是否旋转90度
         /// </summary>
         [AutoViewProperty("标签是否旋转90度")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.R_Dec)]
+
         public decimal R
         {
             get { return _R; }
@@ -98,20 +108,23 @@ namespace SCADA_DAQ.Customer.Models
         /// 板材ID
         /// </summary>
         [AutoViewProperty("板材ID")]
+        [JsonProperty("ID")]
 
-        public string ID
+        [Column(T_Col_Name.App_Hold_SortingLabels.CodeID_Str)]
+
+        public string CodeID
         {
-            get { return _ID; }
+            get { return _CodeID; }
             set
             {
-                if (value != _ID)
+                if (value != _CodeID)
                 {
-                    _ID = value;
-                    OnPropertyChanged(nameof(ID));
+                    _CodeID = value;
+                    OnPropertyChanged(nameof(CodeID));
                 }
             }
         }
-        private string _ID;
+        private string _CodeID;
 
 
 
@@ -121,6 +134,7 @@ namespace SCADA_DAQ.Customer.Models
         /// </summary>
         [AutoViewProperty("板材X坐标")]
         [JsonIgnore]
+
         public decimal PositionX
         {
             get { return _PositionX; }
@@ -162,6 +176,8 @@ namespace SCADA_DAQ.Customer.Models
         /// 板材中心位置X
         /// </summary>
         [JsonProperty("PositionX")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.PositionX_Dec)]
+
         public decimal CenterX
         {
             get { return _CenterX; }
@@ -187,6 +203,8 @@ namespace SCADA_DAQ.Customer.Models
         /// 板材中心位置Y
         /// </summary>
         [JsonProperty("PositionY")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.PositionY_Dec)]
+
         public decimal CenterY
         {
             get { return _CenterY; }
@@ -211,6 +229,8 @@ namespace SCADA_DAQ.Customer.Models
         ///  板材开料长度, Y方向长度
         /// </summary>
         [AutoViewProperty("开料长度(Y)")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.ActualLength_Dec)]
+
         public decimal ActualLength
         {
             get { return _ActualLength; }
@@ -232,6 +252,8 @@ namespace SCADA_DAQ.Customer.Models
         /// 板材开料宽度, X方向长度
         /// </summary>
         [AutoViewProperty("开料宽度(X)")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.ActualWidth_Dec)]
+
         public decimal ActualWidth
         {
             get { return _ActualWidth; }
@@ -253,6 +275,8 @@ namespace SCADA_DAQ.Customer.Models
         /// 是否余料
         /// </summary>
         [AutoViewProperty("是否余料")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.Waste_Dec)]
+
         public int Waste
         {
             get { return _Waste; }
@@ -274,6 +298,8 @@ namespace SCADA_DAQ.Customer.Models
         /// 是否异形
         /// </summary>
         [AutoViewProperty("是否异形")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.Accurate_Dec)]
+
         public int Accurate
         {
             get { return _Accurate; }
@@ -293,6 +319,8 @@ namespace SCADA_DAQ.Customer.Models
         /// 
         /// </summary>
         [AutoViewProperty("任务状态")]
+        [Column(T_Col_Name.App_Hold_SortingLabels.Status_Int)]
+
         public TaskStatus Status
         {
             get { return _Status; }

+ 1 - 1
SCADA_DAQ/Customer/Models/ProcessData.cs

@@ -39,7 +39,7 @@ namespace SCADA_DAQ.Customer.Models
         /// <summary>
         /// 
         /// </summary>
-        [ForeignKey("ID")]
+        [ForeignKey("CodeID")]
         [SCADA.CommonLib.Column(T_Col_Name.App_Demo_ProcessData.ReportId)]
         public int ReportId
         {

+ 19 - 0
SCADA_DAQ/Customer/Models/SortingModel/SortingMacSettingModel.cs

@@ -195,6 +195,25 @@ namespace SCADA_DAQ.Customer.Models.SortingModel
 
 
 
+        /// <summary>
+        /// 当前加工文件
+        /// </summary>
+        /// 
+
+        public string CurrentFileName
+        {
+            get { return _CurrentFileName; }
+            set
+            {
+                if (value != _CurrentFileName)
+                {
+                    _CurrentFileName = value;
+                    OnPropertyChanged(nameof(CurrentFileName));
+                }
+            }
+        }
+        private string _CurrentFileName;
+
 
 
         /// <summary>

+ 3 - 2
SCADA_DAQ/Customer/Service/ScannerService.cs

@@ -122,13 +122,14 @@ namespace SCADA_DAQ.Customer.Service
                 if (barcodeTask.IsAbnormalShape ||
                     minSize < SortingEnv.SortingWorkReportSettingValue.MinSize
                     || (MinProportion < SortingEnv.SortingWorkReportSettingValue.MinProportion && SortingEnv.SortingWorkReportSettingValue.IsMinProportionEnable
-                        || (MinProportion < SortingEnv.SortingWorkReportSettingValue.MinProportion && minSize < 200 && !SortingEnv.SortingWorkReportSettingValue.IsMinProportionEnable)))
+                        || (MinProportion < SortingEnv.SortingWorkReportSettingValue.MinProportion && minSize < 200 && !SortingEnv.SortingWorkReportSettingValue.IsMinProportionEnable))
+                         || Math.Max(barcodeTask.Width, barcodeTask.Height) > 2620)
                 {
                     Plc1.GetListenReg(SortingDeliveryMachine.Tag_CodeMatch).WriteReg(2);
 
                     //Plc1.GetListenReg(SortingDeliveryMachine.Tag_IsLeftovers).WriteReg(0);
                     Plc1.LeftLoversOrAbnormal.Enqueue(2);
-                    Log.Info("板件异型或尺寸或比例太小!");
+                    Log.Info("板件异型或尺寸或比例太小或尺寸超出2620mm!");
 
                 }
                 else

+ 1 - 1
SCADA_DAQ/Customer/Views/Menu/UctFrmBackOfSortingDelivery/UctFrmSortingDelivery.xaml.cs

@@ -56,7 +56,7 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmBackOfSortingDelivery
             ForceBtn.DataContext = _PLC.GetListenReg(SortingDeliveryMachine.Tag_ForceToCache);
             Barcode.Icon = new Image()
             {
-                Source = SCADA.CommonCtrl.WpfHelper.VisualHelper.ImageToImageSource(@"./Content/Img/Code.png")
+                Source = SCADA.CommonCtrl.WpfHelper.VisualHelper.ImageToImageSource(@"./Content/Img/CodeID.png")
             };
             HeteromorphosisDelivery.IconGrid.Visibility = Visibility.Collapsed;
             HeteromorphosisDelivery.Delivery.Left.DataContext = _PLC.GetListenReg(SortingDeliveryMachine.Tag_HeteromorphosisRollerState);

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

@@ -110,8 +110,10 @@
 
                             <wpfcontrol:IconButton Title="废料清除" ButtonKind="ClearButton" Click="IconButton_Click" x:Name="ClearBtn">
                             </wpfcontrol:IconButton>
-                            <wpfcontrol:IconButton Title="重新启动" ButtonKind="ReloadButton" Click="IconButton_Click" x:Name="RestartBtn">
+                            <wpfcontrol:IconButton Title="重新启动" ButtonKind="ReloadButton" Click="RestartBtn_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">

+ 60 - 32
SCADA_DAQ/Customer/Views/Menu/UctFrmSorting/UctFrmSortingMain.xaml.cs

@@ -1,6 +1,8 @@
-using SCADA.CommonCtrl.SCADAUI;
+using DBNames;
+using SCADA.CommonCtrl.SCADAUI;
 using SCADA.CommonCtrl.WpfControl;
 using SCADA.CommonLib;
+using SCADA.CommonLib.Data.DIL;
 using SCADA.Drive;
 using SCADA_DAQ.Customer.Machines;
 using SCADA_DAQ.Customer.Models;
@@ -53,7 +55,7 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
             ClearBtn.DataContext = plc.GetListenReg(SortMachine.Tag_ScrapsClear);
             ResetBtn.DataContext = plc.GetListenReg(SortMachine.Tag_Reset);
             PauseBtn.DataContext = plc.GetListenReg(SortMachine.Tag_Pause);
-            RestartBtn.DataContext = plc.GetListenReg(SortMachine.Tag_PhotographOK);
+            //RestartBtn.DataContext = plc.GetListenReg(SortMachine.Tag_PhotographOK);
             CupResetBtn.DataContext = plc.GetListenReg(SortMachine.Tag_CupReset);
             AlarmRoller.DataContext = plc;
             //PathSelect.Content = new AutoView(plc.File) { FontSize = 22, MaxTitleWidth = 100, ContentWidth = 1000 };
@@ -82,6 +84,7 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
             UpdateStartFlagShow(plc.GetListenReg(SortMachine.Tag_RunStateFlag));
             ShowFlag.DataContext = plc.GetListenReg(SortMachine.Tag_RunStateFlag);
             CameraBtn.DataContext = plc.GetListenReg(SortMachine.Tag_CameraEnable);
+            BuildBoardItems();
             plc.BaseDevice.RegReadValueChanged += BaseDevice_RegReadValueChanged;
         }
 
@@ -142,12 +145,13 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
 
                     ClearBtn.IsEnabled = true;
                     RestartBtn.IsEnabled = true;
+               
                 }
                 else
                 {
                     ClearBtn.IsEnabled = false;
                     RestartBtn.IsEnabled = false;
-
+               
                 }
             });
         }
@@ -159,6 +163,9 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
             if (excutingBoard != null)
             {
                 excutingBoard.Status = Models.TaskStatus.Finished;
+                Env.DAL.App_Hold_SortingLabels.Update($"{T_Col_Name.App_Hold_SortingLabels.CodeID_Str} = '{excutingBoard.CodeID}'",
+                      new UpdateItem(T_Col_Name.App_Hold_SortingLabels.Status_Int, (int)Models.TaskStatus.Finished));
+
             }
         }
 
@@ -166,29 +173,34 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
         {
             Dispatcher.Invoke(new Action(() =>
             {
-                Board.Children.Clear();
-                var index = 1;
-                foreach (var item in plc.Labels)
-                {
-                    var subBoard = new UctBoardView() { Width = (double)item.ActualWidth, Height = (double)item.ActualLength, BoardId = item.ID, BoardIndex = index };
-                    Canvas.SetLeft(subBoard, (double)item.PositionX);
-                    Canvas.SetTop(subBoard, (double)item.PositionY);
 
-                    Board.Children.Add(subBoard);
+                BuildBoardItems();
+            }));
+        }
 
-                    subBoard.DataContext = item;
-                    subBoard.SetBinding(UctBoardView.StatusProperty, new Binding(nameof(LabelModel.Status)));
-                    index++;
-                }
+        public void BuildBoardItems()
+        {
+            Board.Children.Clear();
+            var index = 1;
+            foreach (var item in plc.Labels)
+            {
+                var subBoard = new UctBoardView() { Width = (double)item.ActualWidth, Height = (double)item.ActualLength, BoardId = item.CodeID, BoardIndex = index };
+                Canvas.SetLeft(subBoard, (double)item.PositionX);
+                Canvas.SetTop(subBoard, (double)item.PositionY);
 
-                cup = new UctCup() { Height = 510, Width = 330 };
-                Canvas.SetLeft(cup, -165);
-                Canvas.SetTop(cup, -255);
-                Board.Children.Add(cup);
+                Board.Children.Add(subBoard);
 
-                cup.CupStatus = 0;
+                subBoard.DataContext = item;
+                subBoard.SetBinding(UctBoardView.StatusProperty, new Binding(nameof(LabelModel.Status)));
+                index++;
+            }
 
-            }));
+            cup = new UctCup() { Height = 510, Width = 330 };
+            Canvas.SetLeft(cup, -165);
+            Canvas.SetTop(cup, -255);
+            Board.Children.Add(cup);
+
+            cup.CupStatus = 0;
         }
 
         /// <summary>
@@ -259,17 +271,17 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
             var btn = (IconButton)sender;
             if (btn.DataContext is RegInfo reg)
             {
-                if (reg == plc.GetListenReg(SortMachine.Tag_PhotographOK))
-                {
-                    plc.GetListenReg(SortMachine.Tag_RequestNext).WriteReg(1);
-                    Task.Run(() =>
-                    {
-                        Thread.Sleep(500);
-                        reg.WriteReg(1);
-
-                    });
-                }
-                else if (reg == plc.GetListenReg(SortMachine.Tag_ManualStart))
+                //if (reg == plc.GetListenReg(SortMachine.Tag_PhotographOK))
+                //{
+                //    plc.GetListenReg(SortMachine.Tag_RequestNext).WriteReg(1);
+                //    Task.Run(() =>
+                //    {
+                //        Thread.Sleep(500);
+                //        reg.WriteReg(1);
+
+                //    });
+                //}
+                if (reg == plc.GetListenReg(SortMachine.Tag_ManualStart))
                 {
                     plc.GetListenReg(SortMachine.Tag_SingleModeSort).WriteReg(CustomerEnv.SortingMacConfigValue.IsConnectToCuttingMac == false ? 1 : 0);
                     reg.WriteReg(1);
@@ -304,6 +316,22 @@ namespace SCADA_DAQ.Customer.Views.Menu.UctFrmSorting
         {
 
         }
+
+        private void RestartBtn_Click(object sender, RoutedEventArgs e)
+        {
+            //plc.GetListenReg(SortMachine.Tag_StartSort).SetBit();
+            if (plc.Labels.Where(t => Math.Min(t.ActualWidth, t.ActualLength) <= 80 ||
+                                                                Math.Max(t.ActualWidth, t.ActualLength) <= 250).FirstOrDefault() != null)
+            {
+                plc.GetListenReg(SortMachine.Tag_SmallBoardManualConfirm).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";
 						
 	}
 }