领胜LDS 键盘AOI检测项目
src/Bro.M071.Process/M071Models.cs
@@ -17,6 +17,28 @@
namespace Bro.M071.Process
{
    public class KeyLocation : IComplexDisplay
    {
        [Category("键名配置")]
        [Description("单键键名")]
        [TypeConverter(typeof(KeyNameDictConverter))]
        public string Key { get; set; }
        [Category("位置配置")]
        [Description("单键在键盘平面图上的位置显示")]
        public Rectangle KeyRect { get; set; } = new Rectangle();
        [Category("位置配置")]
        [Description("单键之后间隙位置")]
        public Rectangle IntervalRect { get; set; } = new Rectangle();
        public string GetDisplayText()
        {
            return $"{Key}:{KeyRect.X},{KeyRect.Y},{KeyRect.Width},{KeyRect.Height}";
        }
    }
    public class KeyAlgorithem : IComplexDisplay
    {
        [Browsable(false)]
@@ -75,7 +97,7 @@
    {
        public string GetDisplayText()
        {
            return (IsEnabled ? "" : "禁用 ") + Name + " " + string.Join(" ", Destination.Select(u => u.GetDisplayText())) + " " + CameraOp.GetDisplayText();
            return (IsEnabled ? "" : "禁用 ") + Name + " " + MotionOp.GetDisplayText() + " " + CameraOp.GetDisplayText();
        }
        public List<string> GetHalconToolPathList()
@@ -137,13 +159,13 @@
            get => key;
            set
            {
                AlignName = key = value;
                AliasName = key = value;
            }
        }
        [Category("键名配置")]
        [Description("别名")]
        public string AlignName { get; set; }
        public string AliasName { get; set; }
        [Category("启用设置")]
        [Description("true:启用 false:禁用")]
@@ -178,7 +200,22 @@
        public string GetDisplayText()
        {
            return $"{AlignName}";
            string snapShot = "未指定";
            using (var scope = GlobalVar.Container.BeginLifetimeScope())
            {
                var config = scope.Resolve<IProcessConfig>();
                if (config != null)
                {
                    var snapshotPoint = (config as M071Config).SnapshotPointCollection.FirstOrDefault(u => u.Id == SnapshotPointId);
                    if (snapshotPoint != null)
                    {
                        snapShot = snapshotPoint.Name;
                    }
                }
            }
            return $"{AliasName}-{snapShot}-{ImageSeq}";
        }
        public List<string> GetHalconToolPathList()
@@ -204,10 +241,15 @@
    public class ProductionMeasurement : INotifyPropertyChanged, IDisposable
    {
        public string Barcode;
        public string PResult;
        public List<MeasurementUint> Measurements = new List<MeasurementUint>();
        public List<MeasurementUnit> Measurements = new List<MeasurementUnit>();
        public List<IShapeElement> ElementList = new List<IShapeElement>();
        public DateTime? StartTime = null;
        public DateTime? EndTime = null;
        public event PropertyChangedEventHandler PropertyChanged;
@@ -235,7 +277,7 @@
        }
    }
    public class MeasurementUint : IComplexDisplay, INotifyPropertyChanged, IDisposable
    public class MeasurementUnit : IComplexDisplay, INotifyPropertyChanged, IDisposable
    {
        public string Id = Guid.NewGuid().ToString();
@@ -262,7 +304,7 @@
        #region 显示
        [Browsable(false)]
        public Rectangle DisplayLocation { get; set; } = new Rectangle();
        public Rectangle DisplayLocation { get; set; } = new Rectangle(10, 10, 100, 100);
        #endregion
        #region 检测结果
@@ -312,7 +354,7 @@
        [Category("单键配置")]
        [Description("单键结果配置")]
        [TypeConverter(typeof(KeyUnitResultConverter))]
        public string KeyResult { get; set; } = "";
        public string KeyResultId { get; set; } = "";
        public List<HImage> KeyImages = new List<HImage>();
@@ -342,7 +384,7 @@
        {
            string msg = Key;
            msg += string.IsNullOrWhiteSpace(KeyResult) ? "" : $"-{KeyResult}";
            msg += string.IsNullOrWhiteSpace(KeyResultId) ? "" : $"-{KeyResultId}";
            return msg;
        }
@@ -372,6 +414,8 @@
                if (valuePairs == null || valuePairs.Count == 0)
                {
                    IsDone = false;
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsDone"));
                    return;
                }
                foreach (KeyValuePair<string, double> pair in valuePairs)