From 1c4426810c71eead57084be8a18ade8d314dd8c4 Mon Sep 17 00:00:00 2001 From: patrick <patrick.xu@broconcentric.com> Date: 星期二, 10 十二月 2019 14:24:31 +0800 Subject: [PATCH] 1. 重构项目 --- src/A032.Process/ProcessConfig.cs | 95 +++++++++++++++++++++++++++++++++++++---------- 1 files changed, 75 insertions(+), 20 deletions(-) diff --git a/src/A032.Process/ProcessConfig.cs b/src/A032.Process/ProcessConfig.cs index c7cbb46..afe171a 100644 --- a/src/A032.Process/ProcessConfig.cs +++ b/src/A032.Process/ProcessConfig.cs @@ -1,26 +1,23 @@ -锘縰sing Autofac; -using Bro.Common.Base; +锘縰sing Bro.Common.Base; 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; using Bro.Device.SeerAGV; using Bro.Device.Station; using Newtonsoft.Json; -using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; using System.Linq; -using System.Text; -using System.Threading.Tasks; using static Bro.Common.Helper.EnumHelper; namespace A032.Process { - public class ProcessConfig : IStationConfig + public class ProcessConfig : IStationConfig, IHalconToolPath { #region 璁惧閰嶇疆 [Category("璁惧閰嶇疆")] @@ -70,6 +67,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 +140,7 @@ //[Description("鏄惁閲囩敤澶栭儴绠楀瓙銆倀rue锛氶噰鐢ㄥ閮ㄧ畻瀛愶紝false锛氫娇鐢ㄥ唴閮ㄧ畻娉�")] //public bool IsUsingExternalAlgorithem { get; set; } = true; + #region A032 [Category("璺緞鐩稿叧")] [Description("璺緞鑺傜偣閰嶇疆")] [TypeConverter(typeof(CollectionCountConvert))] @@ -155,19 +157,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 +189,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 +275,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