3 Commits 352a349ab6 ... 5dcfbf9dc2

Author SHA1 Message Date
  陈子杰 5dcfbf9dc2 合并后提交 2 months ago
  陈子杰 9506ece2cb 增加平移 2 months ago
  陈子杰 6aa9cd9740 开料输送增加平移 2 months ago

+ 59 - 1
SCADA_DAQ/Customer/Machines/SortingDeliveryMachine.cs

@@ -1,4 +1,6 @@
-using SCADA.Drive;
+using Mysqlx.Session;
+using SCADA.Drive;
+using SCADA_DAQ.Customer.Models;
 using SCADA_DAQ.Customer.Models.BackOfSortingDelivery;
 using System;
 using System.Collections.Generic;
@@ -52,9 +54,45 @@ namespace SCADA_DAQ.Customer.Machines
         }
         private Queue<int> _LeftLoversOrAbnormal = new Queue<int>();
 
+
+        /// <summary>
+        /// 异型通道板件队列
+        /// </summary>
+        public Queue<BoardModel> AbnormalBoards
+        {
+            get { return _AbnormalBoards; }
+            set
+            {
+                if (value != _AbnormalBoards)
+                {
+                    _AbnormalBoards = value;
+                    OnPropertyChanged(nameof(AbnormalBoards));
+                }
+            }
+        }
+        private Queue<BoardModel> _AbnormalBoards = new Queue<BoardModel>();
+
+
         public string AlarmStr { get => string.Join(",", AlarmCollection.Select(t => t.Desc).ToList()); }
 
 
+        /// <summary>
+        /// 扫码状态
+        /// </summary>
+        public bool IsGetCode
+        {
+            get { return _IsGetCode; }
+            set
+            {
+                if (value != _IsGetCode)
+                {
+                    _IsGetCode = value;
+                    OnPropertyChanged(nameof(IsGetCode));
+                }
+            }
+        }
+        private bool _IsGetCode;
+
 
         public SortingDeliveryMachine(string machieID) : base(machieID)
         {
@@ -77,6 +115,26 @@ namespace SCADA_DAQ.Customer.Machines
                     log.Info("信号误触发!");
                 }
             }
+            else if (reg.Comment.Variable == Tag_PLCGetCode && reg.Value == 1)
+            {
+                if (!IsGetCode)
+                {
+                    GetListenReg(Tag_CodeMatch).WriteReg(2);
+                    LeftLoversOrAbnormal.Enqueue(1);
+                    log.Warn("板件已经经过扫码区域,但上位机没有收到读码器回复!");
+                }
+                IsGetCode = false;
+                reg.ResetBit();
+            }
+            else if (reg.Comment.Variable == Tag_AbnormalHadBoard && reg.Value == 1)
+            {
+                var board = AbnormalBoards.Dequeue();
+                //长度小于1500才平移
+                if (Math.Max(board.Width,board.Length) <= 1900)
+                {
+                    GetListenReg(Tag_AbnormalTranslateMove).SetBit();
+                }
+            }
         }
 
         protected override void AlarmReset(object sender, AlarmTriggedEventArgs e)

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

@@ -109,6 +109,7 @@ namespace SCADA_DAQ.Customer.Service
         private void Sbr1_BarCodeReceived(object sender, SCADA.BarcodeReader.BarcodeReceivedEventArgs e)
         {
             var barcode = e.Barcode;
+            Plc1.IsGetCode = true;
 
             var barcodeTask = BoardTasks.Where(t => t.BoardID == barcode).FirstOrDefault();
             if (barcodeTask == null)
@@ -117,9 +118,9 @@ namespace SCADA_DAQ.Customer.Service
             }
             //var barcodeTask = Env.DAL.App_Hold_BoardInfo.GetData<BoardTaskModel>(t=>t.BoardID == barcode).FirstOrDefault();
             var api = new WebApiHelper(_ScannerServiceConfig.Url);
-            if ((DateTime.Now - LastScanTime).TotalSeconds > 3)
+            if ((DateTime.Now - LastScanTime).TotalSeconds > 4)
             {
-                Plc1.GetListenReg(SortingDeliveryMachine.Tag_CodeMatch).WriteReg(0);
+                //Plc1.GetListenReg(SortingDeliveryMachine.Tag_CodeMatch).WriteReg(0);
 
                 if (barcode != "NoRead" && barcodeTask != null)
                 {
@@ -138,6 +139,13 @@ namespace SCADA_DAQ.Customer.Service
 
                         //Plc1.GetListenReg(SortingDeliveryMachine.Tag_IsLeftovers).WriteReg(0);
                         Plc1.LeftLoversOrAbnormal.Enqueue(2);
+                        var board = new BoardModel
+                        {
+                            Width = (int)barcodeTask.Width,
+                            Length = (int)barcodeTask.Height,
+                            Thickness = (int)barcodeTask.Thickness,
+                        };
+                        Plc1.AbnormalBoards.Enqueue(board);
                         Log.Info("板件异型或尺寸或比例太小或尺寸超出2620mm!");
 
                     }
@@ -189,7 +197,6 @@ namespace SCADA_DAQ.Customer.Service
                 Log.Warn("扫码频率过高,已经屏蔽");
             }
             LastScanTime = DateTime.Now;
-           
             
             
             //if (barcodeTask != null )

+ 14 - 0
SCADA_DAQ/Machines/SortingDeliveryMachine_开料分拣输送.cs

@@ -1449,6 +1449,20 @@ namespace SCADA_DAQ.Customer.Machines
 		/// <para>备注:相机扫码输出</para> 
 		/// </summary>
 		public const string @Tag_PLCGetCode="PLCGetCode";
+			
+		/// <summary>寄存器:M80【AbnormalHadBoard】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:异型滚筒上有板</para> 
+		/// </summary>
+		public const string @Tag_AbnormalHadBoard="AbnormalHadBoard";
+			
+		/// <summary>寄存器:M101【AbnormalTranslateMove】
+		/// <para>单位:</para> 
+		/// <para>缩放:1 类型: Default</para> 
+		/// <para>备注:异型滚筒平移板件</para> 
+		/// </summary>
+		public const string @Tag_AbnormalTranslateMove="AbnormalTranslateMove";
 						
 	}
 }