| | |
| | | using Bro.Common.Helper; |
| | | using Bro.Common.Interface; |
| | | using Bro.Common.Model; |
| | | using HalconDotNet; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | using System.Drawing.Design; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace Bro.M071.Process |
| | |
| | | { |
| | | 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() |
| | |
| | | [Description("true:启用 false:禁用")] |
| | | public bool IsEnabled { get; set; } = true; |
| | | |
| | | [Category("设备配置")] |
| | | [Description("运动设备")] |
| | | [TypeConverter(typeof(DeviceSelectorConverter<IMotion>))] |
| | | public string MotionDevice { get; set; } |
| | | //[Category("设备配置")] |
| | | //[Description("运动设备")] |
| | | //[TypeConverter(typeof(DeviceSelectorConverter<IMotion>))] |
| | | //public string MotionDevice { get; set; } |
| | | |
| | | [Category("运动点位")] |
| | | [Description("运动点位")] |
| | | //[Category("运动点位")] |
| | | //[Description("运动点位")] |
| | | //[TypeConverter(typeof(ComplexObjectConvert))] |
| | | //[Editor(typeof(ComplexCollectionEditor<AxisInfo>), typeof(UITypeEditor))] |
| | | //public List<AxisInfo> Destination { get; set; } = new List<AxisInfo>(); |
| | | |
| | | [Category("运动机构配置")] |
| | | [Description("运动机构配置")] |
| | | [TypeConverter(typeof(ComplexObjectConvert))] |
| | | [Editor(typeof(ComplexCollectionEditor<AxisInfo>), typeof(UITypeEditor))] |
| | | public List<AxisInfo> Destination { get; set; } = new List<AxisInfo>(); |
| | | [Editor(typeof(IOperationConfigByDeviceEditor), typeof(UITypeEditor))] |
| | | public DeviceOpBind MotionOp { get; set; } = new DeviceOpBind(); |
| | | |
| | | [Category("相机和操作配置")] |
| | | [Description("相机和操作配置")] |
| | |
| | | |
| | | public class ProductionMeasurement : INotifyPropertyChanged, IDisposable |
| | | { |
| | | public string Barcode { get; set; } |
| | | public string Barcode; |
| | | |
| | | public List<MeasurementUint> Measurements { get; set; } = new List<MeasurementUint>(); |
| | | public List<MeasurementUnit> Measurements = new List<MeasurementUnit>(); |
| | | |
| | | public List<IShapeElement> ElementList = new List<IShapeElement>(); |
| | | |
| | | public event PropertyChangedEventHandler PropertyChanged; |
| | | |
| | | public void Dispose() |
| | | { |
| | | Barcode = null; |
| | | |
| | | Measurements?.ForEach(m => m?.Dispose()); |
| | | Measurements = null; |
| | | |
| | | Barcode = null; |
| | | GC.Collect(); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | public class MeasurementUint : IComplexDisplay, INotifyPropertyChanged, IDisposable |
| | | public class MeasurementUnit : IComplexDisplay, INotifyPropertyChanged, IDisposable |
| | | { |
| | | public string Id = Guid.NewGuid().ToString(); |
| | | |
| | |
| | | { |
| | | if (string.IsNullOrWhiteSpace(Name)) |
| | | { |
| | | return (IsEnabled ? "" : "禁用 ") + string.Join("-", KeyUnitCollection.Select(u => u.GetDisplayText())) + "-" + MeasureType.ToString(); |
| | | return (IsEnabled ? "" : "禁用 ") + string.Join("-", KeyUnitCollection.Select(u => u.GetDisplayText())) + "-" + MeasureType?.ToString(); |
| | | } |
| | | else |
| | | { |
| | |
| | | [Category("单键配置")] |
| | | [Description("单键结果配置")] |
| | | [TypeConverter(typeof(KeyUnitResultConverter))] |
| | | public string KeyResult { get; set; } = ""; |
| | | public string KeyResultId { get; set; } = ""; |
| | | |
| | | |
| | | public List<HImage> KeyImages = new List<HImage>(); |
| | | |
| | | public volatile int ImageSaveStatus = 0; |
| | | //[Browsable(false)] |
| | | //public NoticedDictionary<string, double?> MeasureValueDict { get; set; } = new NoticedDictionary<string, double?>(); |
| | | |
| | |
| | | { |
| | | string msg = Key; |
| | | |
| | | msg += string.IsNullOrWhiteSpace(KeyResult) ? "" : $"-{KeyResult}"; |
| | | msg += string.IsNullOrWhiteSpace(KeyResultId) ? "" : $"-{KeyResultId}"; |
| | | |
| | | return msg; |
| | | } |
| | | |
| | | public void Dispose() |
| | | { |
| | | SpinWait wait = new SpinWait(); |
| | | while (ImageSaveStatus != 0) |
| | | { |
| | | wait.SpinOnce(); |
| | | } |
| | | |
| | | KeyImages?.ForEach(i => |
| | | { |
| | | i?.Dispose(); |
| | | i = null; |
| | | }); |
| | | KeyImages = null; |
| | | MeasureValueDict = null; |
| | | } |
| | | |