领胜LDS 键盘AOI检测项目
wells.liu
2020-07-09 da0da2d1238555c4ff488dbaaae1371ba4cf6827
Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071
2个文件已添加
14个文件已修改
573 ■■■■ 已修改文件
src/Bro.Common.Device/DeviceBase/CameraBase.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Device/DeviceBase/MotionCardBase.cs 137 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Model/Base/DeviceConfigBase.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Model/Bro.Common.Model.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Model/Forms/FrmDeviceOpConfigEditor.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Model/Helper/PropertyConvertHelper.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Model/Interface/IOperationConfig.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Model/Model/LaserScanParam.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Model/Model/MotionCardRelated.cs 314 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Device.GTSCard/GTSCardDriver.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Device.Gocator/Bro.Device.Gocator.csproj 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Device.Gocator/GocatorDriver.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Device.Gocator/packages.config 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/M071Process.cs 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Process/ProcessControl.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Process/ProcessControl_Calibration.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Device/DeviceBase/CameraBase.cs
@@ -848,6 +848,11 @@
        bool IsAddtionalSaved { get; set; }
        event Action<ImageSet> OnImageSetTimeout;
        /// <summary>
        /// 序列化操作的图像信息
        /// </summary>
        string ImageData { get; set; }
    }
    public class ImageSet : IImageSet
@@ -887,6 +892,8 @@
        public object SaveLock { get; set; } = new object();
        public virtual string ImageData { get; set; }
        public event Action<ImageSet> OnImageSetTimeout;
        private Timer autoDisposeTimer = null;
src/Bro.Common.Device/DeviceBase/MotionCardBase.cs
@@ -190,13 +190,48 @@
        [Category("板卡操作")]
        [Description("板卡操作配置基类集合,依次执行")]
        [TypeConverter(typeof(CollectionCountConvert))]
        [Editor(typeof(ComplexCollectionEditor<MotionCardOperationSet>), typeof(UITypeEditor))]
        [Editor(typeof(MotionCardOperationSetEditor), typeof(UITypeEditor))]
        public List<MotionCardOperationSet> OperationCollection { get; set; } = new List<MotionCardOperationSet>();
        public string GetDisplayText()
        {
            //OperationCollection.ForEach(o =>
            //{
            //    o.MotionCardId = DeviceId;
            //});
            return string.Join(" ", OperationCollection.Select(u => u.GetDisplayText()));
        }
    }
    public class MotionCardOperationSetEditor : ComplexCollectionEditor<MotionCardOperationSet>
    {
        public MotionCardOperationSetEditor(Type type) : base(type) { }
        IOperationConfig opConfig = null;
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context.Instance is IOperationConfig config && value is List<MotionCardOperationSet> setList)
            {
                opConfig = config;
                setList.ForEach(set => set.MotionCardId = opConfig.DeviceId);
            }
            return base.EditValue(context, provider, value);
        }
        protected override object CreateInstance(Type itemType)
        {
            object obj = base.CreateInstance(itemType);
            if (obj is MotionCardOperationSet set)
            {
                set.MotionCardId = opConfig?.DeviceId;
            }
            return obj;
        }
    }
    [Device("MotionOperationSet", "运动操作配置基类", EnumHelper.DeviceAttributeType.OperationConfig)]
@@ -230,18 +265,21 @@
        [DisplayName("IO确认超时")]
        public int IOConfirmTimeout { get; set; } = 0;
        //[Category("板卡运动配置")]
        //[DisplayName("运动配置集合")]
        //[Description("MovingOps:运动配置集合")]
        //[TypeConverter(typeof(CollectionCountConvert))]
        //[Editor(typeof(ComplexCollectionEditor<MovingOption>), typeof(UITypeEditor))]
        //public List<MovingOption> MovingOps { get; set; } = new List<MovingOption>();
        [Category("板卡运动配置")]
        [DisplayName("运动配置集合")]
        [Description("MovingOps:运动配置集合")]
        [TypeConverter(typeof(ComplexObjectConvert))]
        [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
        public MotionOperationCollection MotionOperationCollection { get; set; } = new MotionOperationCollection();
        [TypeConverter(typeof(CollectionCountConvert))]
        [Editor(typeof(MovingOpsCollectionEditor), typeof(UITypeEditor))]
        public List<MovingOption> MovingOps { get; set; } = new List<MovingOption>();
        public string MotionCardId = "";
        //[Category("板卡运动配置")]
        //[DisplayName("运动配置集合")]
        //[Description("MovingOps:运动配置集合")]
        //[TypeConverter(typeof(ComplexObjectConvert))]
        //[Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
        //public MotionOperationCollection MotionOperationCollection { get; set; } = new MotionOperationCollection();
        public string GetDisplayText()
@@ -276,14 +314,15 @@
            }
            string moving = "";
            //MovingOps.ForEach(i =>
            //{
            //    moving += i.GetDisplayText() + " ";
            //});
            //if (moving != "")
            //{
            //    moving = " 运动:" + moving;
            //}
            MovingOps.ForEach(i =>
            {
                moving += i.GetDisplayText() + " ";
            });
            if (moving != "")
            {
                moving = " 运动:" + moving;
            }
            return (preCheck + output + confirm + moving).Trim();
        }
@@ -444,4 +483,66 @@
        //}
    }
    public class MovingOpsCollectionEditor : ComplexCollectionEditor<MovingOption>
    {
        public MovingOpsCollectionEditor(Type type) : base(type)
        {
        }
        MotionCardBase motionCard = null;
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context.Instance is MotionCardOperationSet set)
            {
                if (!string.IsNullOrWhiteSpace(set.MotionCardId))
                {
                    using (var scope = GlobalVar.Container.BeginLifetimeScope())
                    {
                        var deviceList = scope.Resolve<List<IDevice>>();
                        if (deviceList != null)
                        {
                            motionCard = deviceList.FirstOrDefault(u => u.Id == set.MotionCardId) as MotionCardBase;
                        }
                    }
                }
                if (motionCard != null && value is List<MovingOption> ops)
                {
                    ops.ForEach(o => o.SetAxisSetting(motionCard.IConfig.AxisSettings));
                }
            }
            return base.EditValue(context, provider, value);
        }
        protected override object SetItems(object editValue, object[] value)
        {
            Array.ForEach(value, v =>
             {
                 if (v is MovingOption op && motionCard != null)
                 {
                     op.SetAxisSetting(motionCard.IConfig.AxisSettings);
                 }
             });
            return base.SetItems(editValue, value);
        }
        ///// <summary>
        ///// 限制一次选一个实例
        ///// </summary>
        ///// <returns></returns>
        //protected override bool CanSelectMultipleInstances()
        //{
        //    return false;
        //}
        ///// <summary>
        ///// 指定创建的对象类型
        ///// </summary>
        ///// <returns></returns>
        //protected override Type CreateCollectionItemType()
        //{
        //    return typeof(MovingOption);
        //}
    }
}
src/Bro.Common.Model/Base/DeviceConfigBase.cs
@@ -43,6 +43,10 @@
        [Browsable(false)]
        [JsonIgnore]
        public virtual string DeviceId { get; set; } = "";
        [Browsable(false)]
        [JsonIgnore]
        public virtual string OutputData { get; set; } = "";
    }
    public class InitialConfigBase : IInitialConfig
src/Bro.Common.Model/Bro.Common.Model.csproj
@@ -151,6 +151,7 @@
    <Compile Include="Model\CustomizedPoint.cs" />
    <Compile Include="Model\CustomizedRectangle.cs" />
    <Compile Include="Model\DeviceOpBind.cs" />
    <Compile Include="Model\LaserScanParam.cs" />
    <Compile Include="Model\ModbusFrame.cs" />
    <Compile Include="Model\MonitorSet.cs" />
    <Compile Include="Model\MotionCardRelated.cs" />
src/Bro.Common.Model/Forms/FrmDeviceOpConfigEditor.cs
@@ -120,6 +120,7 @@
        {
            Bind.Device = cboDevice.SelectedValue.ToString();
            Bind.OpConfig = propGrid.SelectedObject as IOperationConfig;
            Bind.OpConfig.DeviceId = Bind.Device;
            this.DialogResult = DialogResult.OK;
        }
src/Bro.Common.Model/Helper/PropertyConvertHelper.cs
@@ -679,7 +679,8 @@
                TextBox tbox = new TextBox
                {
                    Dock = DockStyle.Fill,
                    Multiline = true
                    Multiline = true,
                    ScrollBars = ScrollBars.Both,
                };
                form.Controls.Add(tbox);
src/Bro.Common.Model/Interface/IOperationConfig.cs
@@ -31,5 +31,10 @@
        /// 调用该操作配置的设备Id
        /// </summary>
        string DeviceId { get; set; }
        /// <summary>
        /// 操作执行后部分输出结果,目前拟采用序列化后的字符串方式保存
        /// </summary>
        string OutputData { get; set; }
    }
}
src/Bro.Common.Model/Model/LaserScanParam.cs
New file
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bro.Common.Model
{
    public class LaserScanParam
    {
        public int Resolution_X { get; set; }
        public int Resolution_Y { get; set; }
        public int Resolution_Z { get; set; }
        public int Offset_X { get; set; }
        public int Offset_Y { get; set; }
        public int Offset_Z { get; set; }
        public int Angle_Z { get; set; }
    }
}
src/Bro.Common.Model/Model/MotionCardRelated.cs
@@ -1,9 +1,11 @@
using Bro.Common.Helper;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
@@ -241,115 +243,129 @@
    /// <summary>
    /// 运动对象
    /// </summary>
    public class MovingOption : INotifyPropertyChanged, IComplexDisplay
    public class MovingOption : IComplexDisplay
    {
        private int axisIndex = 0;
        [Category("运动配置")]
        [DisplayName("运动轴索引")]
        [Description("AxisIndex:运动轴索引")]
        [TypeConverter(typeof(AxisIndexConvert))]
        public string AxisIndexStr { get; set; } = "0";
        [Browsable(false)]
        [JsonIgnore]
        public int AxisIndex
        {
            get => axisIndex;
            set
            {
                if (axisIndex != value)
                {
                    axisIndex = value;
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("AxisIndex"));
                }
                axisIndex = value;
            }
            get => int.Parse(AxisIndexStr);
            set => AxisIndexStr = value.ToString();
        }
        private MotionMode moveMode = MotionMode.Normal;
        //private int axisIndex = 0;
        //[Category("运动配置")]
        //[DisplayName("运动轴索引")]
        //[Description("AxisIndex:运动轴索引")]
        //[TypeConverter(typeof(AxisIndexConvert))]
        //public int AxisIndex { get; set; }
        //{
        //    get => axisIndex;
        //    set
        //    {
        //        if (axisIndex != value)
        //        {
        //            axisIndex = value;
        //            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("AxisIndex"));
        //        }
        //        axisIndex = value;
        //    }
        //}
        //private MotionMode moveMode = MotionMode.Normal;
        [Category("运动配置")]
        [DisplayName("运动模式")]
        [Description("MoveMode:运动模式")]
        public MotionMode MoveMode
        {
            get => moveMode;
            set
            {
                if (moveMode != value)
                {
                    moveMode = value;
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MoveMode"));
                }
        public MotionMode MoveMode { get; set; } = MotionMode.Normal;
        //{
        //    get => moveMode;
        //    set
        //    {
        //        if (moveMode != value)
        //        {
        //            moveMode = value;
        //            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MoveMode"));
        //        }
                moveMode = value;
            }
        }
        //        moveMode = value;
        //    }
        //}
        private bool isAbsolute = true;
        //private bool isAbsolute = true;
        [Category("运动配置")]
        [DisplayName("是否绝对运动")]
        [Description("IsAbsolute:是否绝对运动")]
        public bool IsAbsolute
        {
            get => isAbsolute;
            set
            {
                if (isAbsolute != value)
                {
                    isAbsolute = value;
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsAbsolute"));
                }
        public bool IsAbsolute { get; set; } = true;
        //{
        //    get => isAbsolute;
        //    set
        //    {
        //        if (isAbsolute != value)
        //        {
        //            isAbsolute = value;
        //            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsAbsolute"));
        //        }
                isAbsolute = value;
            }
        }
        //        isAbsolute = value;
        //    }
        //}
        private int destination = 0;
        //private int destination = 0;
        [Category("运动配置")]
        [DisplayName("目的地")]
        [Description("Destination:目的地")]
        public int Destination
        {
            get => destination;
            set
            {
                if (destination != value)
                {
                    destination = value;
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Destination"));
                }
        public int Destination { get; set; }
        //{
        //    get => destination;
        //    set
        //    {
        //        if (destination != value)
        //        {
        //            destination = value;
        //            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Destination"));
        //        }
                destination = value;
            }
        }
        //        destination = value;
        //    }
        //}
        private VelocityPara velocityPara = new VelocityPara();
        //private VelocityPara velocityPara = new VelocityPara();
        [Category("运动配置")]
        [DisplayName("速度参数")]
        [Description("VelocityPara:速度参数")]
        [TypeConverter(typeof(ComplexObjectConvert))]
        [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
        public VelocityPara VelocityPara
        {
            get => velocityPara;
            set
            {
                velocityPara = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("VelocityPara"));
            }
        }
        public VelocityPara VelocityPara { get; set; } = new VelocityPara();
        //{
        //    get => velocityPara;
        //    set
        //    {
        //        velocityPara = value;
        //        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("VelocityPara"));
        //    }
        //}
        private GoHomePara goHomePara = new GoHomePara();
        //private GoHomePara goHomePara = new GoHomePara();
        [Category("运动配置")]
        [DisplayName("回原点参数")]
        [Description("GoHomePara:速度参数")]
        [TypeConverter(typeof(ComplexObjectConvert))]
        [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
        public GoHomePara GoHomePara
        {
            get => goHomePara;
            set
            {
                goHomePara = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("GoHomePara"));
            }
        }
        public GoHomePara GoHomePara { get; set; } = new GoHomePara();
        //{
        //    get => goHomePara;
        //    set
        //    {
        //        goHomePara = value;
        //        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("GoHomePara"));
        //    }
        //}
        [Category("板卡运动配置")]
        [Description("超时设置,单位:ms")]
@@ -357,6 +373,7 @@
        public int MovingTimeout { get; set; } = 0;
        internal List<AxisSetting> _axisSettingList = new List<AxisSetting>();
        public void SetAxisSetting(List<AxisSetting> settings)
        {
            if (settings != null)
@@ -365,7 +382,7 @@
        public string GetDisplayText()
        {
            string axisName = AxisIndex.ToString();
            string axisName = AxisIndexStr;
            var axisSet = _axisSettingList.FirstOrDefault(a => a.AxisIndex == AxisIndex);
            if (axisSet != null)
            {
@@ -373,70 +390,113 @@
            }
            return axisName + "," + MoveMode.ToString() + "," + (IsAbsolute ? "Abs" : "Rel") + "," + Destination;
        }
        public event PropertyChangedEventHandler PropertyChanged;
        //public event PropertyChangedEventHandler PropertyChanged;
    }
    public class AxisIndexConvert : TypeConverter
    public class AxisIndexConvert : ComboBoxItemTypeConvert
    {
        Dictionary<int, string> _indexNameDict = new Dictionary<int, string>();
        public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        public override Hashtable GetConvertHash(ITypeDescriptorContext context)
        {
            return true;
        }
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            MovingOption mo = context.Instance as MovingOption;
            _indexNameDict = mo._axisSettingList.ToDictionary(a => a.AxisIndex, a => a.AxisIndex + "-" + a.AxisName);
            return new StandardValuesCollection(_indexNameDict.Keys);
        }
        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
        {
            if (sourceType == typeof(string))
            Hashtable table = new Hashtable();
            if (context.Instance is MovingOption op)
            {
                return true;
            }
            return base.CanConvertFrom(context, sourceType);
        }
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v)
        {
            if (v is string)
            {
                foreach (var indexName in _indexNameDict)
                op._axisSettingList.ForEach(a =>
                {
                    if (indexName.Value == v.ToString())
                    {
                        return indexName.Key;
                    }
                }
                return Convert.ToInt32(v);
                    table[a.AxisIndex.ToString()] = a.AxisName;
                });
            }
            return base.ConvertFrom(context, culture, v);
            return table;
        }
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                if (_indexNameDict.ContainsKey(Convert.ToInt32(v)))
                {
                    return _indexNameDict[Convert.ToInt32(v)];
                }
            }
            return base.ConvertTo(context, culture, v, destinationType);
        }
        //public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
        //{
        //    bool flag = base.CanConvertFrom(context, sourceType);
        //    return flag;
        //}
        public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
        {
            return false;
        }
        //public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
        //{
        //    return base.CanConvertTo(context, destinationType);
        //}
        //public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object v)
        //{
        //    //if (string.IsNullOrWhiteSpace(v.ToString()))
        //    //{
        //    //    return 0;
        //    //}
        //    return base.ConvertFrom(context, culture, Convert.ToInt32(v));
        //}
        //public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object v, Type destinationType)
        //{
        //    return base.ConvertTo(context, culture, v, destinationType);
        //}
    }
    //public class AxisIndexConvert : TypeConverter
    //{
    //    Dictionary<int, string> _indexNameDict = new Dictionary<int, string>();
    //    public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
    //    {
    //        return true;
    //    }
    //    public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
    //    {
    //        MovingOption mo = context.Instance as MovingOption;
    //        _indexNameDict = mo._axisSettingList.ToDictionary(a => a.AxisIndex, a => a.AxisIndex + "-" + a.AxisName);
    //        return new StandardValuesCollection(_indexNameDict.Keys);
    //    }
    //    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
    //    {
    //        if (sourceType == typeof(string))
    //        {
    //            return true;
    //        }
    //        return base.CanConvertFrom(context, sourceType);
    //    }
    //    public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v)
    //    {
    //        if (v is string)
    //        {
    //            foreach (var indexName in _indexNameDict)
    //            {
    //                if (indexName.Value == v.ToString())
    //                {
    //                    return indexName.Key;
    //                }
    //            }
    //            return Convert.ToInt32(v);
    //        }
    //        return base.ConvertFrom(context, culture, v);
    //    }
    //    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v, Type destinationType)
    //    {
    //        if (destinationType == typeof(string))
    //        {
    //            if (_indexNameDict.ContainsKey(Convert.ToInt32(v)))
    //            {
    //                return _indexNameDict[Convert.ToInt32(v)];
    //            }
    //        }
    //        return base.ConvertTo(context, culture, v, destinationType);
    //    }
    //    public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
    //    {
    //        return false;
    //    }
    //}
    public class AxisConflictSet : IComplexDisplay
    {
        [Category("1.轴冲突条件")]
src/Bro.Device.GTSCard/GTSCardDriver.cs
@@ -162,7 +162,7 @@
            // 2.板卡运动
            if (CurrentState == DeviceState.DSOpen)
            {
                responseMessage = MoveToPoint(operationSet.MotionOperationCollection);
                responseMessage = MoveToPoint(new MotionOperationCollection() { MovingOps = operationSet.MovingOps });
                if (!responseMessage.Result)
                {
                    return responseMessage;
@@ -362,14 +362,15 @@
        {
            List<short> resultCode = new List<short>() { 0 };
            GTSCardAPI.TTrapPrm trapprm = new GTSCardAPI.TTrapPrm();
            resultCode.Add(GTSCardAPI.GT_PrfTrap((short)IConfig.CardNum, (short)optionPara.AxisIndex));
            resultCode.Add(GTSCardAPI.GT_GetTrapPrm((short)IConfig.CardNum, (short)optionPara.AxisIndex, out trapprm));
            short axisIndex = short.Parse(optionPara.AxisIndexStr);
            resultCode.Add(GTSCardAPI.GT_PrfTrap((short)IConfig.CardNum, axisIndex));
            resultCode.Add(GTSCardAPI.GT_GetTrapPrm((short)IConfig.CardNum, axisIndex, out trapprm));
            trapprm.smoothTime = 1;
            trapprm.acc = optionPara.VelocityPara.Acc != 0 ? optionPara.VelocityPara.Acc : 1;
            trapprm.dec = optionPara.VelocityPara.Dec != 0 ? optionPara.VelocityPara.Dec : 1;
            resultCode.Add(GTSCardAPI.GT_SetTrapPrm((short)IConfig.CardNum, (short)optionPara.AxisIndex, ref trapprm));
            resultCode.Add(GTSCardAPI.GT_SetVel((short)IConfig.CardNum, (short)optionPara.AxisIndex, optionPara.VelocityPara.Velocity * IConfig.AxisVelocityRatio));
            resultCode.Add(GTSCardAPI.GT_SetTrapPrm((short)IConfig.CardNum, axisIndex, ref trapprm));
            resultCode.Add(GTSCardAPI.GT_SetVel((short)IConfig.CardNum, axisIndex, optionPara.VelocityPara.Velocity * IConfig.AxisVelocityRatio));
            var resultOK = resultCode.All(u => u == (short)GTSRetCode.GRCRunOK);
            if (!resultOK)
src/Bro.Device.Gocator/Bro.Device.Gocator.csproj
@@ -65,6 +65,9 @@
    <Reference Include="kApiNet">
      <HintPath>..\..\libs\gocator\kApiNet.dll</HintPath>
    </Reference>
    <Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Drawing" />
@@ -109,5 +112,8 @@
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <None Include="packages.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
src/Bro.Device.Gocator/GocatorDriver.cs
@@ -1,11 +1,13 @@
using Bro.Common.Base;
using Bro.Common.Helper;
using Bro.Common.Interface;
using Bro.Common.Model;
using HalconDotNet;
using Lmi3d.GoSdk;
using Lmi3d.GoSdk.Messages;
using Lmi3d.Zen;
using Lmi3d.Zen.Io;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -114,6 +116,18 @@
                                imgSet.HImage_2 = new HImage();
                                imgSet.HImage_2.GenImage1("uint2", (int)width, zoomHeight, zoomPtr);
                                LaserScanParam para = new LaserScanParam()
                                {
                                    Resolution_X = surfaceMsg.XResolution,
                                    Resolution_Y = surfaceMsg.YResolution,
                                    Resolution_Z = surfaceMsg.ZResolution,
                                    Offset_X = surfaceMsg.XOffset,
                                    Offset_Y = surfaceMsg.YOffset,
                                    Offset_Z = surfaceMsg.ZOffset,
                                    Angle_Z = surfaceMsg.ZAngle,
                                };
                                imgSet.ImageData = JsonConvert.SerializeObject(para);
                                //imgSet.HImage_2 = imgSet.HImage_2.ZoomImageSize((int)width, zoomHeight, "constant");
                            }
src/Bro.Device.Gocator/packages.config
New file
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Newtonsoft.Json" version="11.0.2" targetFramework="net452" />
</packages>
src/Bro.M071.Process/M071Process.cs
@@ -7,6 +7,7 @@
using Bro.M071.Model.Model;
using Bro.Process;
using HalconDotNet;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -221,11 +222,10 @@
                      if (camera == null)
                          return;
                      string imgSetId = "";
                      HImage hImage = null;
                      IImageSet set = null;
                      try
                      {
                          hImage = CollectHImage(camera, s.CameraOp.OpConfig, out imgSetId);
                          set = CollectHImage(camera, s.CameraOp.OpConfig);
                      }
                      catch (ProcessException pEx)
                      {
@@ -233,12 +233,12 @@
                          throw pEx;
                      }
                      if (string.IsNullOrWhiteSpace(imgSetId))
                      if (set == null)
                      {
                          return;
                      }
                      RunImageHandle(camera, s.CameraOp.OpConfig, hImage, s.Id, s.Name, pMeasure.Measurements);
                      RunImageHandle(camera, s.CameraOp.OpConfig, set, s.Id, s.Name, pMeasure.Measurements);
                  });
            BarCode = "";
@@ -348,7 +348,7 @@
                                IShapeElement indicator = null;
                                pMeasure.ElementList.Add(indicator);
                                //输出图形基元到界面 todo
                                //输出图形基元到界面
                                OnElementUpdated?.BeginInvoke(indicator, null, null);
                                SaveKeyImages(pMeasure.Barcode, m);
@@ -617,7 +617,7 @@
        }
        #endregion
        private async void RunImageHandle(CameraBase camera, IOperationConfig opConfig, HImage hImage, string snapshotId, string snapshotName, List<MeasurementUnit> measureList)
        private async void RunImageHandle(CameraBase camera, IOperationConfig opConfig, IImageSet imgSet, string snapshotId, string snapshotName, List<MeasurementUnit> measureList)
        {
            await Task.Run(() =>
             {
@@ -625,7 +625,8 @@
                 var keyBindCollection = measureList.SelectMany(u => u.KeyUnitCollection).Where(u => keys.Any(k => k.Key == u.Key)).ToList();
                 string toolKey = (opConfig as CameraOprerationConfigBase).AlgorithemPath;
                 HObject images = hImage;
                 HObject images = imgSet.HImage;
                 LaserScanParam scanParam = JsonConvert.DeserializeObject<LaserScanParam>(imgSet.ImageData);
                 if (!string.IsNullOrWhiteSpace(toolKey))
                 {
@@ -637,7 +638,7 @@
                         return;
                     }
                     _halconToolDict[toolKey].InputImageDic["INPUT_Image"] = hImage;
                     _halconToolDict[toolKey].InputImageDic["INPUT_Image"] = imgSet.HImage;
                     if (!_halconToolDict[toolKey].RunProcedure(out string error))
                     {
                         LogAsync(DateTime.Now, $"{snapshotName}取图算法异常,{error}", "");
@@ -685,6 +686,8 @@
                             else
                             {
                                 _halconToolDict[keyToolKey].InputImageDic["INPUT_Image"] = image;
                                 _halconToolDict[keyToolKey].InputTupleDic["INPUT_Resolution_X"] = scanParam.Resolution_X;
                                 _halconToolDict[keyToolKey].InputTupleDic["INPUT_Resolution_Z"] = scanParam.Resolution_Z;
                                 if (!_halconToolDict[keyToolKey].RunProcedure(out string error))
                                 {
                                     LogAsync(DateTime.Now, $"{k.AliasName}检测算法异常,{error}", "");
@@ -717,11 +720,11 @@
                     image.Dispose();
                 });
                 if (count.I != 1)
                 {
                     hImage?.Dispose();
                     hImage = null;
                 }
                 //if (count.I != 1)
                 //{
                 //    hImage?.Dispose();
                 //    hImage = null;
                 //}
             });
        }
        #endregion
src/Bro.Process/ProcessControl.cs
@@ -626,7 +626,7 @@
        #endregion
        #region 图像处理
        protected HImage CollectHImage(CameraBase camera, IOperationConfig opConfig, out string imgSetId, [CallerMemberName]string methodCode = "")
        protected IImageSet CollectHImage(CameraBase camera, IOperationConfig opConfig, [CallerMemberName]string methodCode = "")
        {
            IImageSet set = null;
@@ -675,8 +675,7 @@
                TimeRecordCSV(DateTime.Now, camera.Name, methodCode + "采图", (int)sw.ElapsedMilliseconds);
            }
            imgSetId = set?.Id;
            return set.HImage;
            return set;
        }
        protected async void CameraUpdateImage(CameraBase camera, Bitmap image, string setId)
src/Bro.Process/ProcessControl_Calibration.cs
@@ -107,7 +107,12 @@
        {
            //string imgSetId = "";
            List<IShapeElement> pointList = new List<IShapeElement>();
            using (HObject hImage = CollectHImage(camera, config.CameraOpConfig, out string imgSetId))
            IImageSet set = CollectHImage(camera, config.CameraOpConfig);
            if (set == null)
                return;
            using (HObject hImage = set.HImage)
            {
                var tool = GetHalconTool(config.CameraOpConfig);
@@ -125,7 +130,7 @@
                    pointList.Add(new PointIndicator((float)xList[i], (float)yList[i]));
                }
                camera.SaveFitImage(pointList, imgSetId);
                camera.SaveFitImage(pointList, set.Id);
            }
            config.Results[sequence - 1].ImageMarkPoint = new CustomizedPoint((pointList[0] as PointIndicator).Center);