版博士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.
 
 
 
 

234 lines
14 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 List<PointF> LeftPoints { get; set; }
  53. public Point LeftPoint { get; set; }
  54. [PropertyOrder(43), Browsable(true), Category("5 走位"), DisplayName("5.3 自动计算步进"), Description("使用自动计算的步进位置")]
  55. public bool AutoStep { get; set; }
  56. [PropertyOrder(44), Browsable(true), Category("5 走位"), DisplayName("5.4 X方向步进次数"), Description("使用手动设置的步进次数")]
  57. public int Xstep { get; set; }
  58. [PropertyOrder(45), Browsable(true), Category("5 走位"), DisplayName("5.5 Y方向步进次数"), Description("使用手动设置的步进次数")]
  59. public int Ystep { get; set; }
  60. [PropertyOrder(51), Browsable(true), Category("6 打印"), DisplayName("6.01 开启Excel打印"), Description("启用本工序数据打印")]
  61. public bool OpenPrint { get; set; }
  62. [PropertyOrder(52), Browsable(true), Category("6 打印"), DisplayName("6.02 打印缺陷总数"), Description("打印数据的位置")]
  63. public string ExcelDefectCount { get; set; }
  64. [PropertyOrder(53), Browsable(true), Category("6 打印"), DisplayName("6.03 打印堵孔数量"), Description("打印数据的位置")]
  65. public string ExcelDKCount { get; set; }
  66. [PropertyOrder(54), Browsable(true), Category("6 打印"), DisplayName("6.04 打印脏污数量"), Description("打印数据的位置")]
  67. public string ExcelZWCount { get; set; }
  68. [PropertyOrder(55), Browsable(true), Category("6 打印"), DisplayName("6.05 打印钢丝异常数量"), Description("打印数据的位置")]
  69. public string ExcelGSYCCount { get; set; }
  70. [PropertyOrder(56), Browsable(true), Category("6 打印"), DisplayName("6.06 打印纤维丝数量"), Description("打印数据的位置")]
  71. public string ExcelXWSCount { get; set; }
  72. [PropertyOrder(57), Browsable(true), Category("6 打印"), DisplayName("6.07 打印缺口数量"), Description("打印数据的位置")]
  73. public string ExcelQKCount { get; set; }
  74. [PropertyOrder(58), Browsable(true), Category("6 打印"), DisplayName("6.08 打印针孔数量"), Description("打印数据的位置")]
  75. public string ExcelZKCount { get; set; }
  76. [PropertyOrder(59), Browsable(true), Category("6 打印"), DisplayName("6.09 打印泡泡数量"), Description("打印数据的位置")]
  77. public string ExcelPPCount { get; set; }
  78. [PropertyOrder(60), Browsable(true), Category("6 打印"), DisplayName("6.10 打印划伤数量"), Description("打印数据的位置")]
  79. public string ExcelHSCount { get; set; }
  80. [PropertyOrder(61), Browsable(true), Category("6 打印"), DisplayName("6.11 打印压线数量"), Description("打印数据的位置")]
  81. public string ExcelYXCount { get; set; }
  82. [PropertyOrder(62), Browsable(true), Category("6 打印"), DisplayName("6.12 打印斜边数量"), Description("打印数据的位置")]
  83. public string ExcelXBCount { get; set; }
  84. [PropertyOrder(63), Browsable(true), Category("6 打印"), DisplayName("6.13 打印格栅数量"), Description("打印数据的位置")]
  85. public string ExcelSXCount { get; set; }
  86. //[PropertyOrder(63), Browsable(true), Category("6 打印"), DisplayName("6.14 打印断栅数量"), Description("打印数据的位置")]
  87. public string ExcelDSCount { get; set; }
  88. [PropertyOrder(64), Browsable(true), Category("6 打印"), DisplayName("6.15 打印钢丝断裂数量"), Description("打印数据的位置")]
  89. public string ExcelGSDLCount { get; set; }
  90. [PropertyOrder(65), Browsable(true), Category("6 打印"), DisplayName("6.16 打印残胶堵孔数量"), Description("打印数据的位置")]
  91. public string ExcelCJDKCount { get; set; }
  92. [PropertyOrder(71), Browsable(true), Category("7 标签打印"), DisplayName("7.01 开启标签打印"), Description("启用本工序数据打印")]
  93. public bool OpenPrintLabel { get; set; }
  94. [PropertyOrder(72), Browsable(true), Category("7 标签打印"), DisplayName("7.02 标签打印缺陷总数"), Description("打印数据的位置")]
  95. public string LabelDefectCount { get; set; }
  96. [PropertyOrder(73), Browsable(true), Category("7 标签打印"), DisplayName("7.03 标签打印堵孔数量"), Description("打印数据的位置")]
  97. public string LabelDKCount { get; set; }
  98. [PropertyOrder(74), Browsable(true), Category("7 标签打印"), DisplayName("7.04 标签打印脏污数量"), Description("打印数据的位置")]
  99. public string LabelZWCount { get; set; }
  100. [PropertyOrder(75), Browsable(true), Category("7 标签打印"), DisplayName("7.05 标签打印钢丝异常数量"), Description("打印数据的位置")]
  101. public string LabelGSYCCount { get; set; }
  102. [PropertyOrder(76), Browsable(true), Category("7 标签打印"), DisplayName("7.06 标签打印纤维丝数量"), Description("打印数据的位置")]
  103. public string LabelXWSCount { get; set; }
  104. [PropertyOrder(77), Browsable(true), Category("7 标签打印"), DisplayName("7.07 标签打印缺口数量"), Description("打印数据的位置")]
  105. public string LabelQKCount { get; set; }
  106. [PropertyOrder(78), Browsable(true), Category("7 标签打印"), DisplayName("7.08 标签打印针孔数量"), Description("打印数据的位置")]
  107. public string LabelZKCount { get; set; }
  108. [PropertyOrder(79), Browsable(true), Category("7 标签打印"), DisplayName("7.09 标签打印泡泡数量"), Description("打印数据的位置")]
  109. public string LabelPPCount { get; set; }
  110. [PropertyOrder(80), Browsable(true), Category("7 标签打印"), DisplayName("7.10 标签打印划伤数量"), Description("打印数据的位置")]
  111. public string LabelHSCount { get; set; }
  112. [PropertyOrder(81), Browsable(true), Category("7 标签打印"), DisplayName("7.11 标签打印压线数量"), Description("打印数据的位置")]
  113. public string LabelYXCount { get; set; }
  114. [PropertyOrder(82), Browsable(true), Category("7 标签打印"), DisplayName("7.12 标签打印斜边数量"), Description("打印数据的位置")]
  115. public string LabelXBCount { get; set; }
  116. [PropertyOrder(83), Browsable(true), Category("7 标签打印"), DisplayName("7.13 标签打印格栅数量"), Description("打印数据的位置")]
  117. public string LabelSXCount { get; set; }
  118. //[PropertyOrder(83), Browsable(true), Category("7 标签打印"), DisplayName("7.14 标签打印断栅数量"), Description("打印数据的位置")]
  119. public string LabelDSCount { get; set; }
  120. [PropertyOrder(84), Browsable(true), Category("7 标签打印"), DisplayName("7.15 标签打印钢丝断裂数量"), Description("打印数据的位置")]
  121. public string LabelGSDLCount { get; set; }
  122. [PropertyOrder(85), Browsable(true), Category("7 标签打印"), DisplayName("7.16 标签打印残胶堵孔数量"), Description("打印数据的位置")]
  123. public string LabelCJDKCount { get; set; }
  124. [PropertyOrder(91), Browsable(true), Category("8 控制"), DisplayName("8.1 禁用工序"), Description("禁用本工序(True-是;False-否)")]
  125. public bool Disable { get; set; }
  126. public SizeDefectProp()
  127. {
  128. OpenSize = true;
  129. EngineName = "My_PI_PT_General";
  130. AsynRun = true;
  131. OpenDefect = true;
  132. CutSize = new Size(ConfMgr.Instance.SysConfigParams.Defect_CutSize.Width, ConfMgr.Instance.SysConfigParams.Defect_CutSize.Height);
  133. Resize = new Size(ConfMgr.Instance.SysConfigParams.Defect_ReSize.Width, ConfMgr.Instance.SysConfigParams.Defect_ReSize.Height); ;
  134. Thresholds = ConfMgr.Instance.SysConfigParams.Defect_Thresholds;
  135. ThresholdsClass = "0.3,0.3,0.3,0.7,0.3,0.3,0.6,0.3,0.3,0.3,0.3";
  136. ThresholdsClassCount = 11;
  137. AsynDefectRun = true;
  138. ExposureTime = 30000;
  139. Gain = 0;
  140. VelLow = 0;
  141. VelHigh = 100;
  142. Acc = 200;
  143. Dec = 200;
  144. WaitTime = 50;
  145. Disable = false;
  146. AutoStep = true;
  147. AutoLeft = true;
  148. LeftPoints = new List<PointF>();
  149. LeftPoint = new Point();
  150. Xstep = 5;
  151. Ystep = 5;
  152. OpenPrint = false;
  153. OpenPrintLabel = false;
  154. ExcelDefectCount = "";
  155. ExcelDKCount = "";
  156. ExcelZWCount = "";
  157. ExcelGSYCCount = "";
  158. ExcelXWSCount = "";
  159. ExcelQKCount = "";
  160. ExcelZKCount = "";
  161. ExcelPPCount = "";
  162. ExcelHSCount = "";
  163. ExcelYXCount = "";
  164. ExcelXBCount = "";
  165. ExcelSXCount = "";
  166. ExcelDSCount = "";
  167. ExcelGSDLCount = "";
  168. ExcelCJDKCount = "";
  169. LabelDefectCount = "";
  170. LabelDKCount = "";
  171. LabelZWCount = "";
  172. LabelGSYCCount = "";
  173. LabelXWSCount = "";
  174. LabelQKCount = "";
  175. LabelZKCount = "";
  176. LabelPPCount = "";
  177. LabelHSCount = "";
  178. LabelYXCount = "";
  179. LabelXBCount = "";
  180. LabelSXCount = "";
  181. LabelDSCount = "";
  182. LabelGSDLCount = "";
  183. LabelCJDKCount = "";
  184. }
  185. /// <summary>
  186. /// 序列化
  187. /// </summary>
  188. /// <param name="obj"></param>
  189. /// <returns></returns>
  190. public string serialize()
  191. {
  192. return JsonConvert.SerializeObject(this);
  193. }
  194. /// <summary>
  195. /// 反序列化
  196. /// </summary>
  197. /// <param name="json"></param>
  198. /// <returns></returns>
  199. public void deserialize(string json)
  200. {
  201. var o = JsonConvert.DeserializeObject<SizeDefectProp>(json);
  202. Type type = o.GetType();
  203. System.Reflection.PropertyInfo[] properties = type.GetProperties();
  204. foreach (System.Reflection.PropertyInfo property in properties)
  205. {
  206. string name = property.Name;
  207. if (!type.GetProperty(name).IsDefined(typeof(JsonIgnoreAttribute), true))
  208. {
  209. var value = property.GetValue(o);
  210. this.GetType().GetProperty(name).SetValue(this, value);
  211. }
  212. }
  213. }
  214. }
  215. }