//时间:20200608 //作者:郝爽 //功能:切割孔 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FileManager; using System.Xml; using System.IO; namespace MeasureData { //操作步骤,在操作失败时,反馈的状态 public enum Operation { Init, PTInsert, GetCutPosition, Cut, PTOut, GetHole, Image, Analysis, Element } //测试结果 public enum State { Ready, //就绪 InProcess, //进行中 Waiting, //等待,半自动化测试过程的状态 Failed, //失败 Success //成功 } //切割孔 public class CutHole: ISlo { #region 切割孔名 /// /// 切割孔名 /// private string m_HoleName; public int HoleNo; public string data_path; public string focus_path; public string StigX_path; public string StigY_path; public string EDS_path; public string workingFolder; public string HoleName { get { return this.m_HoleName; } set { this.m_HoleName = value; } } #endregion #region 坐标位置 private SemPosition m_Position; public SemPosition Position { get { return this.m_Position; } set { this.m_Position = value; } } #endregion #region 工作状态 //开始时间 private DateTime m_start; public DateTime START { get { return this.m_start; } set { this.m_start = value; } } //结束时间 private DateTime m_end; public DateTime END { get { return this.m_end; } set { this.m_end = value; } } //测试结果 private State m_state; public State STATE { get { return this.m_state; } set { this.m_state = value; } } //测量开关 private bool m_switch; public bool SWITCH { get { return this.m_switch; } set { this.m_switch = value; } } #endregion //构造函数 public CutHole() { Init(); } //初始化函数 private void Init() { //设定初始值 m_state = State.Ready; m_switch = false; Position = new SemPosition(); } public void InitPath(int holeNo,string currentWorkingFolder) { HoleNo = holeNo; // arg.HoleName = this.HoleName; //最终数据存放目录 workingFolder = currentWorkingFolder; data_path = workingFolder + "\\" + this.HoleName; //对焦数据存放目录 focus_path = workingFolder + "\\" + this.HoleName + "\\Focus"; //MParam.AutoFocus.Path = focus_path; if (!Directory.Exists(focus_path)) { Directory.CreateDirectory(focus_path); } //StigX数据存放目录 StigX_path = workingFolder + "\\" + this.HoleName + "\\StigX"; //MParam.AutoStigX.Path = StigX_path; if (!Directory.Exists(StigX_path)) { Directory.CreateDirectory(StigX_path); } //StigY数据存放目录 StigY_path = workingFolder + "\\" + this.HoleName + "\\StigY"; //MParam.AutoStigY.Path = StigY_path; if (!Directory.Exists(StigY_path)) { Directory.CreateDirectory(StigY_path); } //EDS数据存放路径 EDS_path = workingFolder + "\\" + this.HoleName + "\\EDS"; // MParam.EDSParam.Path = EDS_path; if (!Directory.Exists(EDS_path)) { Directory.CreateDirectory(EDS_path); } } //样品孔存储xml文档 public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode) { Slo slo_cuthole = new Slo(); xString regName = new xString(); regName.AssignValue("CutHole"); slo_cuthole.Register("RegName", regName); //样品名称 xString SampleName = new xString(); SampleName.AssignValue(this.HoleName); slo_cuthole.Register("SampleName", SampleName); slo_cuthole.Register("Position", this.Position); //开始时间 xTime_t START = new xTime_t(); START.AssignValue(this.START); slo_cuthole.Register("START", START); //结束时间 xTime_t END = new xTime_t(); END.AssignValue(this.END); slo_cuthole.Register("END", END); //测量结果 xInt STATE = new xInt(); STATE.AssignValue(this.STATE.GetHashCode()); slo_cuthole.Register("STATE", STATE); //测量开关 xBool SWITCH = new xBool(); SWITCH.AssignValue(this.SWITCH); slo_cuthole.Register("SWITCH", SWITCH); if (isStoring) { slo_cuthole.Serialize(true, xml, rootNode); } else { slo_cuthole.Serialize(false, xml, rootNode); this.START = START.value(); this.END = END.value(); this.STATE = (State)STATE.value(); this.SWITCH = SWITCH.value(); this.HoleName = SampleName.value(); } } } }