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 | 109 +++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 87 insertions(+), 22 deletions(-) diff --git a/src/A032.Process/ProcessConfig.cs b/src/A032.Process/ProcessConfig.cs index 200811f..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("璁惧閰嶇疆")] @@ -71,6 +72,10 @@ [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("鐩戝惉鎿嶄綔閰嶇疆闆嗗悎")] //[TypeConverter(typeof(CollectionCountConvert))] @@ -102,18 +107,20 @@ [Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))] public string LogPath { get; set; } - [Category("鏃ュ織閰嶇疆")] - [Description("GRR鏃ュ織鏂囦欢澶硅矾寰�")] - [Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))] - public string GRRLogPath { get; set; } + //[Category("鏃ュ織閰嶇疆")] + //[Description("GRR鏃ュ織鏂囦欢澶硅矾寰�")] + //[Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))] + //public string GRRLogPath { get; set; } [Category("CSV鏂囦欢閰嶇疆")] [Description("鏄惁鍋欳SV鏂囦欢杈撳嚭")] + [Browsable(false)] public bool IsCSVOutput { get; set; } = false; [Category("CSV鏂囦欢閰嶇疆")] [Description("CSV杈撳嚭鏂囦欢澶硅矾寰�")] [Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))] + [Browsable(false)] public string CSVFilePath { get; set; } #endregion @@ -123,9 +130,9 @@ //[Editor(typeof(ComplexCollectionEditor<WarningSet>), typeof(UITypeEditor))] //public List<WarningSet> WarningSets { get; set; } = new List<WarningSet>(); - [Category("PLC鐩稿叧閰嶇疆")] - [Description("浜у搧鍑哄垪鏃舵槸鍚︽湁纭鍔ㄤ綔銆倀rue锛氭湁纭鍔ㄤ綔锛岀‘璁ゅ悗浜у搧鍑哄垪锛沠alse锛氭病鏈夌‘璁ゅ姩浣滐紝鏌ヨ鏃朵骇鍝佸嚭鍒�")] - public bool IsConfirmWhenProductionDone { get; set; } = false; + //[Category("PLC鐩稿叧閰嶇疆")] + //[Description("浜у搧鍑哄垪鏃舵槸鍚︽湁纭鍔ㄤ綔銆倀rue锛氭湁纭鍔ㄤ綔锛岀‘璁ゅ悗浜у搧鍑哄垪锛沠alse锛氭病鏈夌‘璁ゅ姩浣滐紝鏌ヨ鏃朵骇鍝佸嚭鍒�")] + //public bool IsConfirmWhenProductionDone { get; set; } = false; [Category("NG鍥剧墖淇濆瓨閰嶇疆")] [Description("NG鍥剧墖淇濆瓨鐩綍")] @@ -137,6 +144,7 @@ //[Description("鏄惁閲囩敤澶栭儴绠楀瓙銆倀rue锛氶噰鐢ㄥ閮ㄧ畻瀛愶紝false锛氫娇鐢ㄥ唴閮ㄧ畻娉�")] //public bool IsUsingExternalAlgorithem { get; set; } = true; + #region A032 [Category("璺緞鐩稿叧")] [Description("璺緞鑺傜偣閰嶇疆")] [TypeConverter(typeof(CollectionCountConvert))] @@ -149,19 +157,25 @@ [Editor(typeof(ComplexCollectionEditor<PositionVisionConfig>), typeof(UITypeEditor))] public List<PositionVisionConfig> VisionConfigCollection { get; set; } = new List<PositionVisionConfig>(); - /// <summary> - /// 绌篢ray涓婃枡闃堝�硷紝AGV涓婄殑绌簍ray鏁伴噺涓嶅ぇ浜庤鏁板�兼椂锛孉GV鍙互鎵ц绌篢ray涓婃枡浠诲姟 - /// </summary> - [Category("闃堝�艰缃�")] - [Description("绌篢ray涓婃枡闃堝�硷紝AGV涓婄殑绌簍ray鏁伴噺涓嶅ぇ浜庤鏁板�兼椂锛孉GV鍙互鎵ц绌篢ray涓婃枡浠诲姟")] - public int AGV_EmptyTrayThreshold { get; set; } = 0; + [Category("瑙嗚閰嶇疆")] + [Description("鏄惁鍚敤瑙嗚寮曞")] + public bool IsEnableVisionGuide { get; set; } = false; - /// <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 VisionGuideTimes { get; set; } = 2; + + [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> /// 浜х嚎蹇欐椂鎷嶇収纭绛夊緟闂撮殧锛屼互绉掍负鍗曚綅 @@ -179,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)] @@ -233,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