From b0a4c47dd74bc41c5df3bab6ddd8de7bcc6a52b0 Mon Sep 17 00:00:00 2001
From: patrick <patrick.xu@broconcentric.com>
Date: 星期五, 06 十二月 2019 18:35:42 +0800
Subject: [PATCH] 1. 重新整理项目,按照A034模式,将设备异步操作修改为类同步操作。使用任务队列来存储和分配任务。

---
 src/A032.Process/ProcessConfig.cs |   89 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 74 insertions(+), 15 deletions(-)

diff --git a/src/A032.Process/ProcessConfig.cs b/src/A032.Process/ProcessConfig.cs
index c7cbb46..f71d683 100644
--- a/src/A032.Process/ProcessConfig.cs
+++ b/src/A032.Process/ProcessConfig.cs
@@ -3,6 +3,7 @@
 using Bro.Common.Helper;
 using Bro.Common.Interface;
 using Bro.Common.Model;
+using Bro.Common.Model.Interface;
 using Bro.Device.AuboRobot;
 using Bro.Device.HikCamera;
 using Bro.Device.OmronFins;
@@ -20,7 +21,7 @@
 
 namespace A032.Process
 {
-    public class ProcessConfig : IStationConfig
+    public class ProcessConfig : IStationConfig, IHalconToolPath
     {
         #region 璁惧閰嶇疆
         [Category("璁惧閰嶇疆")]
@@ -70,6 +71,10 @@
         [TypeConverter(typeof(CollectionCountConvert))]
         [Editor(typeof(OperationConfigBindEditor), typeof(UITypeEditor))]
         public Dictionary<string, IOperationConfig> ProcessOpConfigDict { get; set; } = new Dictionary<string, IOperationConfig>();
+
+        [Category("鎿嶄綔閰嶇疆")]
+        [Description("鎿嶄綔瓒呮椂璁剧疆锛屽崟浣峬in")]
+        public int OperationTimeout { get; set; } = 10;
 
         //[Category("鐩戝惉鍜屾搷浣滈厤缃�")]
         //[Description("鐩戝惉鎿嶄綔閰嶇疆闆嗗悎")]
@@ -139,6 +144,7 @@
         //[Description("鏄惁閲囩敤澶栭儴绠楀瓙銆倀rue锛氶噰鐢ㄥ閮ㄧ畻瀛愶紝false锛氫娇鐢ㄥ唴閮ㄧ畻娉�")]
         //public bool IsUsingExternalAlgorithem { get; set; } = true;
 
+        #region A032
         [Category("璺緞鐩稿叧")]
         [Description("璺緞鑺傜偣閰嶇疆")]
         [TypeConverter(typeof(CollectionCountConvert))]
@@ -155,19 +161,21 @@
         [Description("鏄惁鍚敤瑙嗚寮曞")]
         public bool IsEnableVisionGuide { get; set; } = false;
 
-        /// <summary>
-        /// 绌篢ray涓婃枡闃堝�硷紝AGV涓婄殑绌簍ray鏁伴噺涓嶅ぇ浜庤鏁板�兼椂锛孉GV鍙互鎵ц绌篢ray涓婃枡浠诲姟
-        /// </summary>
-        [Category("闃堝�艰缃�")]
-        [Description("绌篢ray涓婃枡闃堝�硷紝AGV涓婄殑绌簍ray鏁伴噺涓嶅ぇ浜庤鏁板�兼椂锛孉GV鍙互鎵ц绌篢ray涓婃枡浠诲姟")]
-        public int AGV_EmptyTrayThreshold { get; set; } = 0;
+        [Category("瑙嗚閰嶇疆")]
+        [Description("瑙嗚寮曞娆℃暟")]
+        public int VisionGuideTimes { get; set; } = 2;
 
-        /// <summary>
-        /// 婊ray涓嬫枡闃堝�硷紝AGV涓婄殑婊ray鏁伴噺涓嶅皬浜庤鏁板�兼椂锛孉GV鍙互鎵ц婊ray涓嬫枡浠诲姟
-        /// </summary>
-        [Category("闃堝�艰缃�")]
-        [Description("婊ray涓嬫枡闃堝�硷紝AGV涓婄殑婊ray鏁伴噺涓嶅皬浜庤鏁板�兼椂锛孉GV鍙互鎵ц婊ray涓嬫枡浠诲姟")]
-        public int AGV_FullTrayThreshold { get; set; } = 10;
+        [Category("璁惧鍙傛暟閰嶇疆")]
+        [Description("鍏夋簮寮�鍏崇储寮曢厤缃�")]
+        public int LightOutputIndex { get; set; }
+
+        [Category("璁惧鍙傛暟閰嶇疆")]
+        [Description("AGV婊¤浇婊ray/绌篢ray鏁伴噺")]
+        public int AGVAvailableTrayNums { get; set; } = 6;
+
+        [Category("璁惧鍙傛暟閰嶇疆")]
+        [Description("榛樿绛夊緟浠诲姟杞暟銆傚綋鏌愪簺鏉′欢涓嶆弧瓒冲綋鍓嶄换鍔℃墽琛屽墠鎻愶紝褰撳墠浠诲姟浼氱瓑寰呰嫢骞蹭换鍔℃暟鍚庢墽琛�")]
+        public int DefaultWaitShift { get; set; } = 3;
 
         /// <summary>
         /// 浜х嚎蹇欐椂鎷嶇収纭绛夊緟闂撮殧锛屼互绉掍负鍗曚綅
@@ -185,11 +193,43 @@
 
         [Category("闃堝�艰缃�")]
         [Description("鏈哄彴鍘嬫満婊ray鏁伴噺")]
-        public int Machine_FullTrayNum { get; set; }
+        public int Machine_FullTrayNum { get; set; } = 6;
 
         [Category("闃堝�艰缃�")]
         [Description("鏈哄彴鍘嬫満绌篢ray鏁伴噺")]
-        public int Machine_EmptyTrayNum { get; set; }
+        public int Machine_EmptyTrayNum { get; set; } = 6;
+        #endregion
+
+        #region IHalconToolPath
+        public List<string> GetHalconToolPathList()
+        {
+            List<string> list = new List<string>();
+
+            ProcessOpConfigDict.Values.ToList().ForEach(c =>
+            {
+                if (c is IHalconToolPath)
+                {
+                    list.AddRange((c as IHalconToolPath).GetHalconToolPathList());
+                }
+            });
+
+            this.GetType().GetProperties().ToList().ForEach(p =>
+            {
+                var pValue = p.GetValue(this);
+
+                if (pValue is IHalconToolPath)
+                {
+                    list.AddRange((pValue as IHalconToolPath).GetHalconToolPathList());
+                }
+                else if (pValue is IEnumerable<IHalconToolPath>)
+                {
+                    list.AddRange((pValue as IEnumerable<IHalconToolPath>).SelectMany(u => u.GetHalconToolPathList()));
+                }
+            });
+
+            return list.Distinct().ToList();
+        }
+        #endregion
 
         #region Ignore
         [Browsable(false)]
@@ -239,4 +279,23 @@
         public virtual bool IsDBSave { get; set; } = false;
         #endregion
     }
+
+    [Device("OperationTest", "娴嬭瘯鏂规硶閰嶇疆", DeviceAttributeType.OperationConfig)]
+    public class OperationTestConfig : OperationConfigBase
+    {
+        //[Category("娴嬭瘯閰嶇疆")]
+        //[Description("鏂规硶绫诲瀷")]
+        //public TaskType TaskType { get; set; } = TaskType.LoadEmptyTrayToAGV;
+
+        [Category("娴嬭瘯閰嶇疆")]
+        [Description("鏂规硶淇℃伅")]
+        [TypeConverter(typeof(ComplexObjectConvert))]
+        [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
+        public TrayTask TaskInfo { get; set; } = new TrayTask();
+
+        [Category("娴嬭瘯閰嶇疆")]
+        [Description("鎵цAGV璁惧")]
+        [TypeConverter(typeof(AGVDeviceConverter))]
+        public string AGVId { get; set; }
+    }
 }

--
Gitblit v1.8.0