|
- 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 ThicknessProp
- {
- [PropertyOrder(1), Browsable(true), Category("1 测试"), DisplayName("1.1 测试点位数"), Description("需要进行的厚度测试次数")]
- public int TestCnt { get; set; }
- [PropertyOrder(2), Browsable(true), Category("1 测试"), DisplayName("1.2 图纸获取点位"), Description("是否从图纸获取点位(True-是;False-否)")]
- public bool UsePoints { get; set; }
- [PropertyOrder(3), Browsable(true), Category("1 测试"), DisplayName("1.3 测试点位列表"), Description("当不从图纸获取点位时,需要手动输入点位")]
- public List<PointF> Points { get; set; }
-
- [PropertyOrder(11), Browsable(true), Category("2 动作"), DisplayName("2.1 起始速度(mm/s)"), Description("起始速度")]
- public double VelLow { get; set; }
- [PropertyOrder(12), Browsable(true), Category("2 动作"), DisplayName("2.2 运行速度(mm/s)"), Description("运行速度")]
- public double VelHigh { get; set; }
- [PropertyOrder(13), Browsable(true), Category("2 动作"), DisplayName("2.3 加速度(mm/s)"), Description("加速度")]
- public double Acc { get; set; }
- [PropertyOrder(14), Browsable(true), Category("2 动作"), DisplayName("2.4 减速度(mm/s)"), Description("减速度")]
- public double Dec { get; set; }
- [PropertyOrder(15), Browsable(true), Category("2 动作"), DisplayName("2.5 等待稳定时间(ms)"), Description("测高度探头伸出等待稳定时间")]
- public int WaitTime { get; set; }
-
- [PropertyOrder(21), Browsable(true), Category("3 参数"), DisplayName("3.1 读取延时(ms)"), Description("测试读取数据之前延时ms")]
- public int DelayTime { get; set; }
- [PropertyOrder(22), Browsable(true), Category("3 参数"), DisplayName("3.2 读取N个数据"), Description("测试读取多少数据")]
- public int DataCnt { get; set; }
- [PropertyOrder(23), Browsable(true), Category("3 参数"), DisplayName("3.3 单次数据处理"), Description("根据读到的N个数据进行取值处理")]
- public DataProcess ProcessData { get; set; }
- [PropertyOrder(24), Browsable(true), Category("3 参数"), DisplayName("3.4 数据判定方式"), Description("对采集数据进行判定处理的方式")]
- public DataJudgment JudgmentData { get; set; }
-
- [PropertyOrder(31), Browsable(true), Category("4 补偿"), DisplayName("4.1 补偿值(um)"), Description("测试读取数据后加入的补偿值")]
- public double OffsetValue { get; set; }
-
- [PropertyOrder(41), Browsable(true), Category("5 上下限"), DisplayName("5.1 启用流程上下限"), Description("使用流程中设置的上下限判断")]
- public bool OpenUseLimit { get; set; }
- [PropertyOrder(42), Browsable(true), Category("5 上下限"), DisplayName("5.2 标准值"), Description("设置判断标志值")]
- public double StandardValues { get; set; }
- [PropertyOrder(43), Browsable(true), Category("5 上下限"), DisplayName("5.3 上限"), Description("设置判断上限")]
- public double MaxLimit { get; set; }
- [PropertyOrder(44), Browsable(true), Category("5 上下限"), DisplayName("5.4 下限"), Description("设置流程下限")]
- public double MinLimit { 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 ExcelData { get; set; }
- [PropertyOrder(53), Browsable(true), Category("6 打印"), DisplayName("6.03 打印上下限"), Description("打印上下限的位置")]
- public string ExcelLimit { get; set; }
- [PropertyOrder(54), Browsable(true), Category("6 打印"), DisplayName("6.04 开启标签打印"), Description("启用本工序数据打印")]
- public bool OpenPrintLabel { get; set; }
- [PropertyOrder(55), Browsable(true), Category("6 打印"), DisplayName("6.05 标签打印数据"), Description("打印均值数据的位置")]
- public string LabelData { get; set; }
- [PropertyOrder(56), Browsable(true), Category("6 打印"), DisplayName("6.06 标签打印上下限"), Description("打印上下限的位置")]
- public string LabelLimit { get; set; }
- [PropertyOrder(74), Browsable(true), Category("6 打印"), DisplayName("6.07 开启工单打印"), Description("启用本工序数据打印")]
- public bool OpenPrintOrder { get; set; }
- [PropertyOrder(75), Browsable(true), Category("6 打印"), DisplayName("6.08 工单打印数据"), Description("打印均值数据的位置序列")]
- public string OrderData { get; set; }
- [PropertyOrder(76), Browsable(true), Category("6 打印"), DisplayName("6.09 工单打印上下限"), Description("打印上下限的位置序列")]
- public string OrderLimit { get; set; }
- [PropertyOrder(76), Browsable(true), Category("6 打印"), DisplayName("6.10 工单打印测试名称"), Description("打印测试名称的位置序列")]
- public string OrderTestName { get; set; }
- [PropertyOrder(76), Browsable(true), Category("6 打印"), DisplayName("6.11 工单打印综合结果"), Description("打印综合结果的位置序列")]
- public string OrderTestResult { get; set; }
-
-
- [PropertyOrder(61), Browsable(true), Category("7 控制"), DisplayName("7.1 禁用工序"), Description("禁用本工序(True-是;False-否)")]
- public bool Disable { get; set; }
-
- public ThicknessProp()
- {
- TestCnt = 5;
- UsePoints = false;
- Points = new List<PointF>();
-
- VelLow = 0;
- VelHigh = 50;
- Acc = 100;
- Dec = 100;
- WaitTime = 500;
-
- DelayTime = 0;
- DataCnt = 1;
- ProcessData = DataProcess.均值;
- JudgmentData = DataJudgment.均值;
- OffsetValue = 0;
- Disable = false;
-
- OpenUseLimit = false;
- StandardValues = 0;
- MaxLimit = 0;
- MinLimit = 0;
-
- OpenPrint = false;
- OpenPrintLabel = false;
- ExcelData = "";
- ExcelLimit = "";
- LabelData = "";
- LabelLimit = "";
-
- OpenPrintOrder = false;
- OrderData = "";
- OrderLimit = "";
- OrderTestName = "";
- OrderTestResult = "";
- }
- /// <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<ThicknessProp>(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);
- }
- }
- }
- }
- }
|