版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

213 lines
13 KiB

  1. using MaiMuAOI.SysCtrl;
  2. using MaiMuAOI.SysUI.StepUI.PropExtend;
  3. using Newtonsoft.Json;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace MaiMuAOI.SysUI.ProcessStep.Prop
  12. {
  13. public class SizeDefectProp
  14. {
  15. [PropertyOrder(1), Browsable(true), Category("1 尺寸检测"), DisplayName("1.1 启用尺寸检测"), Description("开启尺寸检测(True-是;False-否)")]
  16. public bool OpenSize { get; set; }
  17. [PropertyOrder(2), Browsable(true), Category("1 尺寸检测"), DisplayName("1.2 引擎文件名"), Description("图像处理算法引擎文件名")]
  18. public string EngineName { get; set; }
  19. [PropertyOrder(3), Browsable(true), Category("1 尺寸检测"), DisplayName("1.3 异步运行"), Description("非阻塞后续流程运行(True-是;False-否)")]
  20. public bool AsynRun { get; set; } = true;
  21. [PropertyOrder(11), Browsable(true), Category("2 缺陷检测"), DisplayName("2.1 启用缺陷检测"), Description("开启缺陷检测(True-是;False-否)")]
  22. public bool OpenDefect { get; set; }
  23. [PropertyOrder(12), Browsable(true), Category("2 缺陷检测"), DisplayName("2.2 切割大小"), Description("切割大小")]
  24. public Size CutSize { get; set; }
  25. [PropertyOrder(13), Browsable(true), Category("2 缺陷检测"), DisplayName("2.3 重置大小"), Description("重置大小")]
  26. public Size Resize { get; set; }
  27. [PropertyOrder(14), Browsable(true), Category("2 缺陷检测"), DisplayName("2.4 阀值"), Description("阀值")]
  28. public float Thresholds { get; set; }
  29. [PropertyOrder(15), Browsable(true), Category("2 缺陷检测"), DisplayName("2.5 种类阀值"), Description("多个用半号逗号(,)或分号(;)分隔")]
  30. public string ThresholdsClass { get; set; }
  31. [PropertyOrder(16), Browsable(true), Category("2 缺陷检测"), DisplayName("2.6 种类个数"), Description("种类阀值的数量")]
  32. public int ThresholdsClassCount { get; set; }
  33. [PropertyOrder(17), Browsable(true), Category("2 缺陷检测"), DisplayName("2.7 异步运行"), Description("非阻塞后续流程运行(True-是;False-否)")]
  34. public bool AsynDefectRun { get; set; } = true;
  35. [PropertyOrder(21), Browsable(true), Category("3 相机"), DisplayName("3.1 曝光"), Description("曝光时长(us)")]
  36. public float ExposureTime { get; set; }
  37. [PropertyOrder(22), Browsable(true), Category("3 相机"), DisplayName("3.2 增益"), Description("增益")]
  38. public float Gain { get; set; }
  39. [PropertyOrder(31), Browsable(true), Category("4 动作"), DisplayName("4.1 起始速度(mm/s)"), Description("起始速度")]
  40. public double VelLow { get; set; }
  41. [PropertyOrder(32), Browsable(true), Category("4 动作"), DisplayName("4.2 运行速度(mm/s)"), Description("运行速度")]
  42. public double VelHigh { get; set; }
  43. [PropertyOrder(33), Browsable(true), Category("4 动作"), DisplayName("4.3 加速度(mm/s)"), Description("加速度")]
  44. public double Acc { get; set; }
  45. [PropertyOrder(34), Browsable(true), Category("4 动作"), DisplayName("4.4 减速度(mm/s)"), Description("减速度")]
  46. public double Dec { get; set; }
  47. [PropertyOrder(35), Browsable(true), Category("4 动作"), DisplayName("4.5 等待稳定时间(ms)"), Description("到位等待稳定时间")]
  48. public int WaitTime { get; set; }
  49. [PropertyOrder(41), Browsable(true), Category("5 走位"), DisplayName("5.1 自动计算左上角"), Description("使用自动计算的左上角")]
  50. public bool AutoLeft { get; set; }
  51. [PropertyOrder(42), Browsable(true), Category("5 走位"), DisplayName("5.2 手动左上角位置"), Description("使用手动设置的左上角")]
  52. public Point LeftPoint { get; set; }
  53. [PropertyOrder(43), Browsable(true), Category("5 走位"), DisplayName("5.3 自动计算步进"), Description("使用自动计算的步进位置")]
  54. public bool AutoStep { get; set; }
  55. [PropertyOrder(44), Browsable(true), Category("5 走位"), DisplayName("5.4 X方向步进次数"), Description("使用手动设置的步进次数")]
  56. public int Xstep { get; set; }
  57. [PropertyOrder(45), Browsable(true), Category("5 走位"), DisplayName("5.5 Y方向步进次数"), Description("使用手动设置的步进次数")]
  58. public int Ystep { get; set; }
  59. [PropertyOrder(51), Browsable(true), Category("6 打印"), DisplayName("6.01 开启Excel打印"), Description("启用本工序数据打印")]
  60. public bool OpenPrint { get; set; }
  61. [PropertyOrder(52), Browsable(true), Category("6 打印"), DisplayName("6.02 打印缺陷总数"), Description("打印数据的位置")]
  62. public string ExcelDefectCount { get; set; }
  63. [PropertyOrder(53), Browsable(true), Category("6 打印"), DisplayName("6.03 打印堵孔数量"), Description("打印数据的位置")]
  64. public string ExcelDKCount { get; set; }
  65. [PropertyOrder(52), Browsable(true), Category("6 打印"), DisplayName("6.04 打印脏污数量"), Description("打印数据的位置")]
  66. public string ExcelZWCount { get; set; }
  67. [PropertyOrder(53), Browsable(true), Category("6 打印"), DisplayName("6.05 打印钢丝异常数量"), Description("打印数据的位置")]
  68. public string ExcelGSYCCount { get; set; }
  69. [PropertyOrder(52), Browsable(true), Category("6 打印"), DisplayName("6.06 打印纤维丝数量"), Description("打印数据的位置")]
  70. public string ExcelXWSCount { get; set; }
  71. [PropertyOrder(53), Browsable(true), Category("6 打印"), DisplayName("6.07 打印缺口数量"), Description("打印数据的位置")]
  72. public string ExcelQKCount { get; set; }
  73. [PropertyOrder(52), Browsable(true), Category("6 打印"), DisplayName("6.08 打印针孔数量"), Description("打印数据的位置")]
  74. public string ExcelZKCount { get; set; }
  75. [PropertyOrder(53), Browsable(true), Category("6 打印"), DisplayName("6.09 打印泡泡数量"), Description("打印数据的位置")]
  76. public string ExcelPPCount { get; set; }
  77. [PropertyOrder(52), Browsable(true), Category("6 打印"), DisplayName("6.10 打印划伤数量"), Description("打印数据的位置")]
  78. public string ExcelHSCount { get; set; }
  79. [PropertyOrder(53), Browsable(true), Category("6 打印"), DisplayName("6.11 打印压线数量"), Description("打印数据的位置")]
  80. public string ExcelYXCount { get; set; }
  81. [PropertyOrder(52), Browsable(true), Category("6 打印"), DisplayName("6.12 打印斜边数量"), Description("打印数据的位置")]
  82. public string ExcelXBCount { get; set; }
  83. [PropertyOrder(53), Browsable(true), Category("6 打印"), DisplayName("6.13 打印栅线数量"), Description("打印数据的位置")]
  84. public string ExcelSXCount { get; set; }
  85. [PropertyOrder(54), Browsable(true), Category("7 标签打印"), DisplayName("7.01 开启标签打印"), Description("启用本工序数据打印")]
  86. public bool OpenPrintLabel { get; set; }
  87. [PropertyOrder(52), Browsable(true), Category("7 标签打印"), DisplayName("7.02 标签打印缺陷总数"), Description("打印数据的位置")]
  88. public string LabelDefectCount { get; set; }
  89. [PropertyOrder(53), Browsable(true), Category("7 标签打印"), DisplayName("7.03 标签打印堵孔数量"), Description("打印数据的位置")]
  90. public string LabelDKCount { get; set; }
  91. [PropertyOrder(52), Browsable(true), Category("7 标签打印"), DisplayName("7.04 标签打印脏污数量"), Description("打印数据的位置")]
  92. public string LabelZWCount { get; set; }
  93. [PropertyOrder(53), Browsable(true), Category("7 标签打印"), DisplayName("7.05 标签打印钢丝异常数量"), Description("打印数据的位置")]
  94. public string LabelGSYCCount { get; set; }
  95. [PropertyOrder(52), Browsable(true), Category("7 标签打印"), DisplayName("7.06 标签打印纤维丝数量"), Description("打印数据的位置")]
  96. public string LabelXWSCount { get; set; }
  97. [PropertyOrder(53), Browsable(true), Category("7 标签打印"), DisplayName("7.07 标签打印缺口数量"), Description("打印数据的位置")]
  98. public string LabelQKCount { get; set; }
  99. [PropertyOrder(52), Browsable(true), Category("7 标签打印"), DisplayName("7.08 标签打印针孔数量"), Description("打印数据的位置")]
  100. public string LabelZKCount { get; set; }
  101. [PropertyOrder(53), Browsable(true), Category("7 标签打印"), DisplayName("7.09 标签打印泡泡数量"), Description("打印数据的位置")]
  102. public string LabelPPCount { get; set; }
  103. [PropertyOrder(52), Browsable(true), Category("7 标签打印"), DisplayName("7.10 标签打印划伤数量"), Description("打印数据的位置")]
  104. public string LabelHSCount { get; set; }
  105. [PropertyOrder(53), Browsable(true), Category("7 标签打印"), DisplayName("7.11 标签打印压线数量"), Description("打印数据的位置")]
  106. public string LabelYXCount { get; set; }
  107. [PropertyOrder(52), Browsable(true), Category("7 标签打印"), DisplayName("7.12 标签打印斜边数量"), Description("打印数据的位置")]
  108. public string LabelXBCount { get; set; }
  109. [PropertyOrder(53), Browsable(true), Category("7 打印"), DisplayName("7.13 打印栅线数量"), Description("打印数据的位置")]
  110. public string LabelSXCount { get; set; }
  111. [PropertyOrder(71), Browsable(true), Category("8 控制"), DisplayName("8.1 禁用工序"), Description("禁用本工序(True-是;False-否)")]
  112. public bool Disable { get; set; }
  113. public SizeDefectProp()
  114. {
  115. OpenSize = true;
  116. EngineName = "My_PI_PT_General";
  117. AsynRun = true;
  118. OpenDefect = true;
  119. CutSize = new Size(ConfMgr.Instance.SysConfigParams.Defect_CutSize.Width, ConfMgr.Instance.SysConfigParams.Defect_CutSize.Height);
  120. Resize = new Size(ConfMgr.Instance.SysConfigParams.Defect_ReSize.Width, ConfMgr.Instance.SysConfigParams.Defect_ReSize.Height); ;
  121. Thresholds = ConfMgr.Instance.SysConfigParams.Defect_Thresholds;
  122. ThresholdsClass = "0.3,0.3,0.3,0.7,0.3,0.3,0.6,0.3,0.3,0.3,0.3";
  123. ThresholdsClassCount = 11;
  124. AsynDefectRun = true;
  125. ExposureTime = 30000;
  126. Gain = 0;
  127. VelLow = 0;
  128. VelHigh = 100;
  129. Acc = 200;
  130. Dec = 200;
  131. WaitTime = 50;
  132. Disable = false;
  133. AutoStep = true;
  134. AutoLeft = true;
  135. LeftPoint = new Point();
  136. Xstep = 5;
  137. Ystep = 5;
  138. OpenPrint = false;
  139. OpenPrintLabel = false;
  140. ExcelDefectCount = "";
  141. ExcelDKCount = "";
  142. ExcelZWCount = "";
  143. ExcelGSYCCount = "";
  144. ExcelXWSCount = "";
  145. ExcelQKCount = "";
  146. ExcelZKCount = "";
  147. ExcelPPCount = "";
  148. ExcelHSCount = "";
  149. ExcelYXCount = "";
  150. ExcelXBCount = "";
  151. ExcelSXCount = "";
  152. LabelDefectCount = "";
  153. LabelDKCount = "";
  154. LabelZWCount = "";
  155. LabelGSYCCount = "";
  156. LabelXWSCount = "";
  157. LabelQKCount = "";
  158. LabelZKCount = "";
  159. LabelPPCount = "";
  160. LabelHSCount = "";
  161. LabelYXCount = "";
  162. LabelXBCount = "";
  163. LabelSXCount = "";
  164. }
  165. /// <summary>
  166. /// 序列化
  167. /// </summary>
  168. /// <param name="obj"></param>
  169. /// <returns></returns>
  170. public string serialize()
  171. {
  172. return JsonConvert.SerializeObject(this);
  173. }
  174. /// <summary>
  175. /// 反序列化
  176. /// </summary>
  177. /// <param name="json"></param>
  178. /// <returns></returns>
  179. public void deserialize(string json)
  180. {
  181. var o = JsonConvert.DeserializeObject<SizeDefectProp>(json);
  182. Type type = o.GetType();
  183. System.Reflection.PropertyInfo[] properties = type.GetProperties();
  184. foreach (System.Reflection.PropertyInfo property in properties)
  185. {
  186. string name = property.Name;
  187. if (!type.GetProperty(name).IsDefined(typeof(JsonIgnoreAttribute), true))
  188. {
  189. var value = property.GetValue(o);
  190. this.GetType().GetProperty(name).SetValue(this, value);
  191. }
  192. }
  193. }
  194. }
  195. }