版博士V2.0程序
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

150 linhas
8.0 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 ThicknessProp
  14. {
  15. [PropertyOrder(1), Browsable(true), Category("1 测试"), DisplayName("1.1 测试点位数"), Description("需要进行的厚度测试次数")]
  16. public int TestCnt { get; set; }
  17. [PropertyOrder(2), Browsable(true), Category("1 测试"), DisplayName("1.2 图纸获取点位"), Description("是否从图纸获取点位(True-是;False-否)")]
  18. public bool UsePoints { get; set; }
  19. [PropertyOrder(3), Browsable(true), Category("1 测试"), DisplayName("1.3 测试点位列表"), Description("当不从图纸获取点位时,需要手动输入点位")]
  20. public List<PointF> Points { get; set; }
  21. [PropertyOrder(11), Browsable(true), Category("2 动作"), DisplayName("2.1 起始速度(mm/s)"), Description("起始速度")]
  22. public double VelLow { get; set; }
  23. [PropertyOrder(12), Browsable(true), Category("2 动作"), DisplayName("2.2 运行速度(mm/s)"), Description("运行速度")]
  24. public double VelHigh { get; set; }
  25. [PropertyOrder(13), Browsable(true), Category("2 动作"), DisplayName("2.3 加速度(mm/s)"), Description("加速度")]
  26. public double Acc { get; set; }
  27. [PropertyOrder(14), Browsable(true), Category("2 动作"), DisplayName("2.4 减速度(mm/s)"), Description("减速度")]
  28. public double Dec { get; set; }
  29. [PropertyOrder(15), Browsable(true), Category("2 动作"), DisplayName("2.5 等待稳定时间(ms)"), Description("测高度探头伸出等待稳定时间")]
  30. public int WaitTime { get; set; }
  31. [PropertyOrder(21), Browsable(true), Category("3 参数"), DisplayName("3.1 读取延时(ms)"), Description("测试读取数据之前延时ms")]
  32. public int DelayTime { get; set; }
  33. [PropertyOrder(22), Browsable(true), Category("3 参数"), DisplayName("3.2 读取N个数据"), Description("测试读取多少数据")]
  34. public int DataCnt { get; set; }
  35. [PropertyOrder(23), Browsable(true), Category("3 参数"), DisplayName("3.3 单次数据处理"), Description("根据读到的N个数据进行取值处理")]
  36. public DataProcess ProcessData { get; set; }
  37. [PropertyOrder(24), Browsable(true), Category("3 参数"), DisplayName("3.4 数据判定方式"), Description("对采集数据进行判定处理的方式")]
  38. public DataJudgment JudgmentData { get; set; }
  39. [PropertyOrder(31), Browsable(true), Category("4 补偿"), DisplayName("4.1 补偿值(um)"), Description("测试读取数据后加入的补偿值")]
  40. public double OffsetValue { get; set; }
  41. [PropertyOrder(41), Browsable(true), Category("5 上下限"), DisplayName("5.1 启用流程上下限"), Description("使用流程中设置的上下限判断")]
  42. public bool OpenUseLimit { get; set; }
  43. [PropertyOrder(42), Browsable(true), Category("5 上下限"), DisplayName("5.2 标准值"), Description("设置判断标志值")]
  44. public double StandardValues { get; set; }
  45. [PropertyOrder(43), Browsable(true), Category("5 上下限"), DisplayName("5.3 上限"), Description("设置判断上限")]
  46. public double MaxLimit { get; set; }
  47. [PropertyOrder(44), Browsable(true), Category("5 上下限"), DisplayName("5.4 下限"), Description("设置流程下限")]
  48. public double MinLimit { get; set; }
  49. [PropertyOrder(51), Browsable(true), Category("6 打印"), DisplayName("6.01 开启Excel打印"), Description("启用本工序数据打印")]
  50. public bool OpenPrint { get; set; }
  51. [PropertyOrder(52), Browsable(true), Category("6 打印"), DisplayName("6.02 打印数据"), Description("打印均值数据的位置")]
  52. public string ExcelData { get; set; }
  53. [PropertyOrder(53), Browsable(true), Category("6 打印"), DisplayName("6.03 打印上下限"), Description("打印上下限的位置")]
  54. public string ExcelLimit { get; set; }
  55. [PropertyOrder(54), Browsable(true), Category("6 打印"), DisplayName("6.04 开启标签打印"), Description("启用本工序数据打印")]
  56. public bool OpenPrintLabel { get; set; }
  57. [PropertyOrder(55), Browsable(true), Category("6 打印"), DisplayName("6.05 标签打印数据"), Description("打印均值数据的位置")]
  58. public string LabelData { get; set; }
  59. [PropertyOrder(56), Browsable(true), Category("6 打印"), DisplayName("6.06 标签打印上下限"), Description("打印上下限的位置")]
  60. public string LabelLimit { get; set; }
  61. [PropertyOrder(74), Browsable(true), Category("6 打印"), DisplayName("6.07 开启工单打印"), Description("启用本工序数据打印")]
  62. public bool OpenPrintOrder { get; set; }
  63. [PropertyOrder(75), Browsable(true), Category("6 打印"), DisplayName("6.08 工单打印数据"), Description("打印均值数据的位置序列")]
  64. public string OrderData { get; set; }
  65. [PropertyOrder(76), Browsable(true), Category("6 打印"), DisplayName("6.09 工单打印上下限"), Description("打印上下限的位置序列")]
  66. public string OrderLimit { get; set; }
  67. [PropertyOrder(76), Browsable(true), Category("6 打印"), DisplayName("6.10 工单打印测试名称"), Description("打印测试名称的位置序列")]
  68. public string OrderTestName { get; set; }
  69. [PropertyOrder(76), Browsable(true), Category("6 打印"), DisplayName("6.11 工单打印综合结果"), Description("打印综合结果的位置序列")]
  70. public string OrderTestResult { get; set; }
  71. [PropertyOrder(61), Browsable(true), Category("7 控制"), DisplayName("7.1 禁用工序"), Description("禁用本工序(True-是;False-否)")]
  72. public bool Disable { get; set; }
  73. public ThicknessProp()
  74. {
  75. TestCnt = 5;
  76. UsePoints = false;
  77. Points = new List<PointF>();
  78. VelLow = 0;
  79. VelHigh = 50;
  80. Acc = 100;
  81. Dec = 100;
  82. WaitTime = 500;
  83. DelayTime = 0;
  84. DataCnt = 1;
  85. ProcessData = DataProcess.均值;
  86. JudgmentData = DataJudgment.均值;
  87. OffsetValue = 0;
  88. Disable = false;
  89. OpenUseLimit = false;
  90. StandardValues = 0;
  91. MaxLimit = 0;
  92. MinLimit = 0;
  93. OpenPrint = false;
  94. OpenPrintLabel = false;
  95. ExcelData = "";
  96. ExcelLimit = "";
  97. LabelData = "";
  98. LabelLimit = "";
  99. OpenPrintOrder = false;
  100. OrderData = "";
  101. OrderLimit = "";
  102. OrderTestName = "";
  103. OrderTestResult = "";
  104. }
  105. /// <summary>
  106. /// 序列化
  107. /// </summary>
  108. /// <param name="obj"></param>
  109. /// <returns></returns>
  110. public string serialize()
  111. {
  112. return JsonConvert.SerializeObject(this);
  113. }
  114. /// <summary>
  115. /// 反序列化
  116. /// </summary>
  117. /// <param name="json"></param>
  118. /// <returns></returns>
  119. public void deserialize(string json)
  120. {
  121. var o = JsonConvert.DeserializeObject<ThicknessProp>(json);
  122. Type type = o.GetType();
  123. System.Reflection.PropertyInfo[] properties = type.GetProperties();
  124. foreach (System.Reflection.PropertyInfo property in properties)
  125. {
  126. string name = property.Name;
  127. if (!type.GetProperty(name).IsDefined(typeof(JsonIgnoreAttribute), true))
  128. {
  129. var value = property.GetValue(o);
  130. this.GetType().GetProperty(name).SetValue(this, value);
  131. }
  132. }
  133. }
  134. }
  135. }