123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- //时间:20200608
- //作者:郝爽
- //功能:切割孔
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using FileManager;
- using System.Xml;
- namespace MeasureData
- {
- //操作步骤,在操作失败时,反馈的状态
- public enum Operation
- {
- Init,
- PTInsert,
- GetCutPosition,
- Cut,
- PTOut,
- GetHole,
- Image,
- Analysis,
- Element
- }
- //测试结果
- public enum State
- {
- Unmeasured,
- Failed,
- Success
- }
- //切割孔
- public class CutHole: ISlo
- {
- #region 切割孔名
- /// <summary>
- /// 切割孔名
- /// </summary>
- private string m_HoleName;
- 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 Operation m_opt;
- public Operation OPT
- {
- get { return this.m_opt; }
- set { this.m_opt = value; }
- }
- //开始时间
- 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_opt = Operation.Init;
- m_state = State.Unmeasured;
- m_switch = false;
- Position = new SemPosition();
- }
- //样品孔存储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);
-
- //操作步骤
- xInt OPT = new xInt();
- OPT.AssignValue(this.OPT.GetHashCode());
- slo_cuthole.Register("OPT", OPT);
- //开始时间
- 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.OPT = (Operation)OPT.value();
- this.START = START.value();
- this.END = END.value();
- this.STATE = (State)STATE.value();
- this.SWITCH = SWITCH.value();
- }
- }
- }
- }
|