版博士V2.0程序
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

SizeDefectProp.cs 14 KiB

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