|
- using MaiMuAOI.SysCtrl;
- using MaiMuAOI.SysUI.StepUI.PropExtend;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace MaiMuAOI.SysUI.ProcessStep.Prop
- {
- public class SizeDefectProp
- {
- [PropertyOrder(1), Browsable(true), Category("1 尺寸检测"), DisplayName("1.1 启用尺寸检测"), Description("开启尺寸检测(True-是;False-否)")]
- public bool OpenSize { get; set; }
- [PropertyOrder(2), Browsable(true), Category("1 尺寸检测"), DisplayName("1.2 引擎文件名"), Description("图像处理算法引擎文件名")]
- public string EngineName { get; set; }
- [PropertyOrder(3), Browsable(true), Category("1 尺寸检测"), DisplayName("1.3 异步运行"), Description("非阻塞后续流程运行(True-是;False-否)")]
- public bool AsynRun { get; set; } = true;
-
- [PropertyOrder(11), Browsable(true), Category("2 缺陷检测"), DisplayName("2.1 启用缺陷检测"), Description("开启缺陷检测(True-是;False-否)")]
- public bool OpenDefect { get; set; }
- [PropertyOrder(12), Browsable(true), Category("2 缺陷检测"), DisplayName("2.2 切割大小"), Description("切割大小")]
- public Size CutSize { get; set; }
- [PropertyOrder(13), Browsable(true), Category("2 缺陷检测"), DisplayName("2.3 重置大小"), Description("重置大小")]
- public Size Resize { get; set; }
- [PropertyOrder(14), Browsable(true), Category("2 缺陷检测"), DisplayName("2.4 阀值"), Description("阀值")]
- public float Thresholds { get; set; }
- [PropertyOrder(15), Browsable(true), Category("2 缺陷检测"), DisplayName("2.5 种类阀值"), Description("多个用半号逗号(,)或分号(;)分隔")]
- public string ThresholdsClass { get; set; }
- [PropertyOrder(16), Browsable(true), Category("2 缺陷检测"), DisplayName("2.6 种类个数"), Description("种类阀值的数量")]
- public int ThresholdsClassCount { get; set; }
- [PropertyOrder(17), Browsable(true), Category("2 缺陷检测"), DisplayName("2.7 异步运行"), Description("非阻塞后续流程运行(True-是;False-否)")]
- public bool AsynDefectRun { get; set; } = true;
-
- [PropertyOrder(21), Browsable(true), Category("3 相机"), DisplayName("3.1 曝光"), Description("曝光时长(us)")]
- public float ExposureTime { get; set; }
- [PropertyOrder(22), Browsable(true), Category("3 相机"), DisplayName("3.2 增益"), Description("增益")]
- public float Gain { get; set; }
-
- [PropertyOrder(31), Browsable(true), Category("4 动作"), DisplayName("4.1 起始速度(mm/s)"), Description("起始速度")]
- public double VelLow { get; set; }
- [PropertyOrder(32), Browsable(true), Category("4 动作"), DisplayName("4.2 运行速度(mm/s)"), Description("运行速度")]
- public double VelHigh { get; set; }
- [PropertyOrder(33), Browsable(true), Category("4 动作"), DisplayName("4.3 加速度(mm/s)"), Description("加速度")]
- public double Acc { get; set; }
- [PropertyOrder(34), Browsable(true), Category("4 动作"), DisplayName("4.4 减速度(mm/s)"), Description("减速度")]
- public double Dec { get; set; }
- [PropertyOrder(35), Browsable(true), Category("4 动作"), DisplayName("4.5 等待稳定时间(ms)"), Description("到位等待稳定时间")]
- public int WaitTime { get; set; }
-
- [PropertyOrder(41), Browsable(true), Category("5 走位"), DisplayName("5.1 自动计算左上角"), Description("使用自动计算的左上角")]
- public bool AutoLeft { get; set; }
- [PropertyOrder(42), Browsable(true), Category("5 走位"), DisplayName("5.2 手动左上角位置"), Description("使用手动设置的左上角")]
- public Point LeftPoint { get; set; }
- [PropertyOrder(43), Browsable(true), Category("5 走位"), DisplayName("5.3 自动计算步进"), Description("使用自动计算的步进位置")]
- public bool AutoStep { get; set; }
- [PropertyOrder(44), Browsable(true), Category("5 走位"), DisplayName("5.4 X方向步进次数"), Description("使用手动设置的步进次数")]
- public int Xstep { get; set; }
- [PropertyOrder(45), Browsable(true), Category("5 走位"), DisplayName("5.5 Y方向步进次数"), Description("使用手动设置的步进次数")]
- public int Ystep { get; set; }
-
- [PropertyOrder(51), Browsable(true), Category("6 打印"), DisplayName("6.01 开启Excel打印"), Description("启用本工序数据打印")]
- public bool OpenPrint { get; set; }
- [PropertyOrder(52), Browsable(true), Category("6 打印"), DisplayName("6.02 打印缺陷总数"), Description("打印数据的位置")]
- public string ExcelDefectCount { get; set; }
- [PropertyOrder(53), Browsable(true), Category("6 打印"), DisplayName("6.03 打印堵孔数量"), Description("打印数据的位置")]
- public string ExcelDKCount { get; set; }
- [PropertyOrder(54), Browsable(true), Category("6 打印"), DisplayName("6.04 打印脏污数量"), Description("打印数据的位置")]
- public string ExcelZWCount { get; set; }
- [PropertyOrder(55), Browsable(true), Category("6 打印"), DisplayName("6.05 打印钢丝异常数量"), Description("打印数据的位置")]
- public string ExcelGSYCCount { get; set; }
- [PropertyOrder(56), Browsable(true), Category("6 打印"), DisplayName("6.06 打印纤维丝数量"), Description("打印数据的位置")]
- public string ExcelXWSCount { get; set; }
- [PropertyOrder(57), Browsable(true), Category("6 打印"), DisplayName("6.07 打印缺口数量"), Description("打印数据的位置")]
- public string ExcelQKCount { get; set; }
- [PropertyOrder(58), Browsable(true), Category("6 打印"), DisplayName("6.08 打印针孔数量"), Description("打印数据的位置")]
- public string ExcelZKCount { get; set; }
- [PropertyOrder(59), Browsable(true), Category("6 打印"), DisplayName("6.09 打印泡泡数量"), Description("打印数据的位置")]
- public string ExcelPPCount { get; set; }
- [PropertyOrder(60), Browsable(true), Category("6 打印"), DisplayName("6.10 打印划伤数量"), Description("打印数据的位置")]
- public string ExcelHSCount { get; set; }
- [PropertyOrder(61), Browsable(true), Category("6 打印"), DisplayName("6.11 打印压线数量"), Description("打印数据的位置")]
- public string ExcelYXCount { get; set; }
- [PropertyOrder(62), Browsable(true), Category("6 打印"), DisplayName("6.12 打印斜边数量"), Description("打印数据的位置")]
- public string ExcelXBCount { get; set; }
- [PropertyOrder(63), Browsable(true), Category("6 打印"), DisplayName("6.13 打印栅线数量"), Description("打印数据的位置")]
- public string ExcelSXCount { get; set; }
- [PropertyOrder(64), Browsable(true), Category("6 打印"), DisplayName("6.14 打印钢丝断裂数量"), Description("打印数据的位置")]
- public string ExcelGSDLCount { get; set; }
- [PropertyOrder(65), Browsable(true), Category("6 打印"), DisplayName("6.15 打印残胶堵孔数量"), Description("打印数据的位置")]
- public string ExcelCJDKCount { get; set; }
-
- [PropertyOrder(71), Browsable(true), Category("7 标签打印"), DisplayName("7.01 开启标签打印"), Description("启用本工序数据打印")]
- public bool OpenPrintLabel { get; set; }
- [PropertyOrder(72), Browsable(true), Category("7 标签打印"), DisplayName("7.02 标签打印缺陷总数"), Description("打印数据的位置")]
- public string LabelDefectCount { get; set; }
- [PropertyOrder(73), Browsable(true), Category("7 标签打印"), DisplayName("7.03 标签打印堵孔数量"), Description("打印数据的位置")]
- public string LabelDKCount { get; set; }
- [PropertyOrder(74), Browsable(true), Category("7 标签打印"), DisplayName("7.04 标签打印脏污数量"), Description("打印数据的位置")]
- public string LabelZWCount { get; set; }
- [PropertyOrder(75), Browsable(true), Category("7 标签打印"), DisplayName("7.05 标签打印钢丝异常数量"), Description("打印数据的位置")]
- public string LabelGSYCCount { get; set; }
- [PropertyOrder(76), Browsable(true), Category("7 标签打印"), DisplayName("7.06 标签打印纤维丝数量"), Description("打印数据的位置")]
- public string LabelXWSCount { get; set; }
- [PropertyOrder(77), Browsable(true), Category("7 标签打印"), DisplayName("7.07 标签打印缺口数量"), Description("打印数据的位置")]
- public string LabelQKCount { get; set; }
- [PropertyOrder(78), Browsable(true), Category("7 标签打印"), DisplayName("7.08 标签打印针孔数量"), Description("打印数据的位置")]
- public string LabelZKCount { get; set; }
- [PropertyOrder(79), Browsable(true), Category("7 标签打印"), DisplayName("7.09 标签打印泡泡数量"), Description("打印数据的位置")]
- public string LabelPPCount { get; set; }
- [PropertyOrder(80), Browsable(true), Category("7 标签打印"), DisplayName("7.10 标签打印划伤数量"), Description("打印数据的位置")]
- public string LabelHSCount { get; set; }
- [PropertyOrder(81), Browsable(true), Category("7 标签打印"), DisplayName("7.11 标签打印压线数量"), Description("打印数据的位置")]
- public string LabelYXCount { get; set; }
- [PropertyOrder(82), Browsable(true), Category("7 标签打印"), DisplayName("7.12 标签打印斜边数量"), Description("打印数据的位置")]
- public string LabelXBCount { get; set; }
- [PropertyOrder(83), Browsable(true), Category("7 标签打印"), DisplayName("7.13 标签打印栅线数量"), Description("打印数据的位置")]
- public string LabelSXCount { get; set; }
- [PropertyOrder(84), Browsable(true), Category("7 标签打印"), DisplayName("7.12 标签打印钢丝断裂数量"), Description("打印数据的位置")]
- public string LabelGSDLCount { get; set; }
- [PropertyOrder(85), Browsable(true), Category("7 标签打印"), DisplayName("7.13 标签打印残胶堵孔数量"), Description("打印数据的位置")]
- public string LabelCJDKCount { get; set; }
-
- [PropertyOrder(91), Browsable(true), Category("8 控制"), DisplayName("8.1 禁用工序"), Description("禁用本工序(True-是;False-否)")]
- public bool Disable { get; set; }
-
- public SizeDefectProp()
- {
- OpenSize = true;
- EngineName = "My_PI_PT_General";
- AsynRun = true;
-
- OpenDefect = true;
- CutSize = new Size(ConfMgr.Instance.SysConfigParams.Defect_CutSize.Width, ConfMgr.Instance.SysConfigParams.Defect_CutSize.Height);
- Resize = new Size(ConfMgr.Instance.SysConfigParams.Defect_ReSize.Width, ConfMgr.Instance.SysConfigParams.Defect_ReSize.Height); ;
- Thresholds = ConfMgr.Instance.SysConfigParams.Defect_Thresholds;
- ThresholdsClass = "0.3,0.3,0.3,0.7,0.3,0.3,0.6,0.3,0.3,0.3,0.3";
- ThresholdsClassCount = 11;
- AsynDefectRun = true;
-
- ExposureTime = 30000;
- Gain = 0;
-
- VelLow = 0;
- VelHigh = 100;
- Acc = 200;
- Dec = 200;
- WaitTime = 50;
-
- Disable = false;
-
- AutoStep = true;
- AutoLeft = true;
- LeftPoint = new Point();
- Xstep = 5;
- Ystep = 5;
-
- OpenPrint = false;
- OpenPrintLabel = false;
-
- ExcelDefectCount = "";
- ExcelDKCount = "";
- ExcelZWCount = "";
- ExcelGSYCCount = "";
- ExcelXWSCount = "";
- ExcelQKCount = "";
- ExcelZKCount = "";
- ExcelPPCount = "";
- ExcelHSCount = "";
- ExcelYXCount = "";
- ExcelXBCount = "";
- ExcelSXCount = "";
- ExcelGSDLCount = "";
- ExcelCJDKCount = "";
-
- LabelDefectCount = "";
- LabelDKCount = "";
- LabelZWCount = "";
- LabelGSYCCount = "";
- LabelXWSCount = "";
- LabelQKCount = "";
- LabelZKCount = "";
- LabelPPCount = "";
- LabelHSCount = "";
- LabelYXCount = "";
- LabelXBCount = "";
- LabelSXCount = "";
- LabelGSDLCount = "";
- LabelCJDKCount = "";
- }
-
- /// <summary>
- /// 序列化
- /// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
- public string serialize()
- {
- return JsonConvert.SerializeObject(this);
- }
- /// <summary>
- /// 反序列化
- /// </summary>
- /// <param name="json"></param>
- /// <returns></returns>
- public void deserialize(string json)
- {
- var o = JsonConvert.DeserializeObject<SizeDefectProp>(json);
- Type type = o.GetType();
- System.Reflection.PropertyInfo[] properties = type.GetProperties();
- foreach (System.Reflection.PropertyInfo property in properties)
- {
- string name = property.Name;
- if (!type.GetProperty(name).IsDefined(typeof(JsonIgnoreAttribute), true))
- {
- var value = property.GetValue(o);
- this.GetType().GetProperty(name).SetValue(this, value);
- }
- }
- }
- }
- }
|