领胜LDS 键盘AOI检测项目
patrick.xu
2021-08-02 a383b2288dcfb90e9aa1dcf796e41d9c6be1e429
1. 部分修改
5个文件已修改
89 ■■■■■ 已修改文件
src/Bro.M071.Process/M071Config.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/M071Process.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/M071Process_MES.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/Properties/AssemblyInfo.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_PatchInsertMeasurement.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/M071Config.cs
@@ -214,6 +214,35 @@
        public int RepeatTimes { get; set; } = 1;
    }
    [Device("KeyUnitGenerate", "单键生成配置", EnumHelper.DeviceAttributeType.OperationConfig)]
    public class KeyUnitGenerateConfig : OperationConfigBase
    {
        [Category("键名配置")]
        [Description("开始键")]
        [TypeConverter(typeof(KeyNameDictConverter))]
        public string StartKey { get; set; }
        [Category("键名配置")]
        [Description("结束键")]
        [TypeConverter(typeof(KeyNameDictConverter))]
        public string EndKey { get; set; }
        [Category("图像来源")]
        [Description("拍照点位")]
        [TypeConverter(typeof(SnapshotPointConverter))]
        public string SnapshotPointId { get; set; }
        [Category("算法配置")]
        [Description("单键检测配置算法类型")]
        [TypeConverter(typeof(KeyAlgorithemConverter))]
        public string KeyAlgorithemId { get; set; }
        [Category("算法配置")]
        [Description("单键检测配置结果类型")]
        [TypeConverter(typeof(KeyResultConverter))]
        public string KeyResultId { get; set; }
    }
    public class OperationCombination : IComplexDisplay, IHalconToolPath
    {
        [Category("运动机构配置")]
src/Bro.M071.Process/M071Process.cs
@@ -531,6 +531,48 @@
            return new ProcessResponse();
        }
        [ProcessMethod("KeyUnitGenerate", "GenerateKeyUnitByKeyNames", "生成单键配置", InvokeType.TestInvoke)]
        public ProcessResponse GenerateKeyUnitByKeyNames(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
        {
            if (opConfig is KeyUnitGenerateConfig config)
            {
                int i = 1;
                bool isStart = false;
                bool isEnd = false;
                foreach (string k in Config.KeyNameCollection)
                {
                    if (k == config.StartKey)
                    {
                        isStart = true;
                    }
                    else if (k == config.EndKey)
                    {
                        isEnd = true;
                    }
                    if (isStart)
                    {
                        KeyUnit unit = new KeyUnit();
                        unit.Key = unit.AliasName = k;
                        unit.SnapshotPointId = config.SnapshotPointId;
                        unit.KeyAlgorithemId = config.KeyAlgorithemId;
                        unit.KeyResultId = config.KeyResultId;
                        unit.ImageSeq = i;
                        Config.KeyUnitCollection.Add(unit);
                        i++;
                    }
                    if (isEnd)
                    {
                        break;
                    }
                }
            }
            return new ProcessResponse(true);
        }
        #endregion
        #region 私有方法
src/Bro.M071.Process/M071Process_MES.cs
@@ -9,6 +9,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Bro.M071.Process
{
@@ -229,7 +230,7 @@
                LogAsync(DateTime.Now, $"{pMeasure.Barcode}产品检测数据上传", JsonConvert.SerializeObject(paras));
            }
            string result = "-3";
            string result = "-1";
            int repeatTime = 3;
            do
@@ -245,7 +246,7 @@
                    repeatTime--;
                    Thread.Sleep(100); 
                    result = "-3";
                    result = "-1";
                }
            } while (repeatTime > 0);
@@ -254,6 +255,11 @@
            LogAsync(DateTime.Now, $"{barcode}产品检测数据上传,{result}|{mesReturn.ToString()}", $"耗时:{sw.ElapsedMilliseconds}ms");
            OnCheckHintUpload?.Invoke("检测数据" + mesReturn.ToString(), mesReturn != MESUploadReturn.上传成功);
            if (mesReturn != MESUploadReturn.上传成功)
            {
                MessageBox.Show($"{barcode}产品数据上传失败,{mesReturn.ToString()}\r\n请检查网络连接或确认问题后重新检测", "上传异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private string GetMESAlignmentData(ProductionMeasurement pMeasure)
src/Bro.M071.Process/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.6.0")]
[assembly: AssemblyFileVersion("1.0.6.0")]
[assembly: AssemblyVersion("1.0.7.0")]
[assembly: AssemblyFileVersion("1.0.7.0")]
src/Bro.M071.Process/UI/M071_PatchInsertMeasurement.cs
@@ -165,8 +165,8 @@
                             Config.MeasurementUnitCollection.Add(mUnitDown);
                         }
                         break;
                     case "Blind":
                     case "Blind1":
                     case "BlindExist":
                     case "BlindNotExist":
                         {
                             for (int i = startIndex; i <= endIndex; i++)
                             {