CutHole.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. //时间:20200608
  2. //作者:郝爽
  3. //功能:切割孔
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using FileManager;
  10. using System.Xml;
  11. namespace MeasureData
  12. {
  13. //操作步骤,在操作失败时,反馈的状态
  14. public enum Operation
  15. {
  16. Init,
  17. PTInsert,
  18. GetCutPosition,
  19. Cut,
  20. PTOut,
  21. GetHole,
  22. Image,
  23. Analysis,
  24. Element
  25. }
  26. //测试结果
  27. public enum State
  28. {
  29. Unmeasured,
  30. Failed,
  31. Success
  32. }
  33. //切割孔
  34. public class CutHole: ISlo
  35. {
  36. #region 切割孔名
  37. /// <summary>
  38. /// 切割孔名
  39. /// </summary>
  40. private string m_HoleName;
  41. public string HoleName
  42. {
  43. get { return this.m_HoleName; }
  44. set { this.m_HoleName = value; }
  45. }
  46. #endregion
  47. #region 坐标位置
  48. private SemPosition m_Position;
  49. public SemPosition Position
  50. {
  51. get { return this.m_Position; }
  52. set { this.m_Position = value; }
  53. }
  54. #endregion
  55. #region 工作状态
  56. //操作步骤
  57. private Operation m_opt;
  58. public Operation OPT
  59. {
  60. get { return this.m_opt; }
  61. set { this.m_opt = value; }
  62. }
  63. //开始时间
  64. private DateTime m_start;
  65. public DateTime START
  66. {
  67. get { return this.m_start; }
  68. set { this.m_start = value; }
  69. }
  70. //结束时间
  71. private DateTime m_end;
  72. public DateTime END
  73. {
  74. get { return this.m_end; }
  75. set { this.m_end = value; }
  76. }
  77. //测试结果
  78. private State m_state;
  79. public State STATE
  80. {
  81. get { return this.m_state; }
  82. set { this.m_state = value; }
  83. }
  84. //测量开关
  85. private bool m_switch;
  86. public bool SWITCH
  87. {
  88. get { return this.m_switch; }
  89. set { this.m_switch = value; }
  90. }
  91. #endregion
  92. //构造函数
  93. public CutHole()
  94. {
  95. Init();
  96. }
  97. //初始化函数
  98. private void Init()
  99. {
  100. //设定初始值
  101. m_opt = Operation.Init;
  102. m_state = State.Unmeasured;
  103. m_switch = false;
  104. Position = new SemPosition();
  105. }
  106. //样品孔存储xml文档
  107. public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
  108. {
  109. Slo slo_cuthole = new Slo();
  110. xString regName = new xString();
  111. regName.AssignValue("CutHole");
  112. slo_cuthole.Register("RegName", regName);
  113. //样品名称
  114. xString SampleName = new xString();
  115. SampleName.AssignValue(this.HoleName);
  116. slo_cuthole.Register("SampleName", SampleName);
  117. slo_cuthole.Register("Position", this.Position);
  118. //操作步骤
  119. xInt OPT = new xInt();
  120. OPT.AssignValue(this.OPT.GetHashCode());
  121. slo_cuthole.Register("OPT", OPT);
  122. //开始时间
  123. xTime_t START = new xTime_t();
  124. START.AssignValue(this.START);
  125. slo_cuthole.Register("START", START);
  126. //结束时间
  127. xTime_t END = new xTime_t();
  128. END.AssignValue(this.END);
  129. slo_cuthole.Register("END", END);
  130. //测量结果
  131. xInt STATE = new xInt();
  132. STATE.AssignValue(this.STATE.GetHashCode());
  133. slo_cuthole.Register("STATE", STATE);
  134. //测量开关
  135. xBool SWITCH = new xBool();
  136. SWITCH.AssignValue(this.SWITCH);
  137. slo_cuthole.Register("SWITCH", SWITCH);
  138. if (isStoring)
  139. {
  140. slo_cuthole.Serialize(true, xml, rootNode);
  141. }
  142. else
  143. {
  144. slo_cuthole.Serialize(false, xml, rootNode);
  145. this.OPT = (Operation)OPT.value();
  146. this.START = START.value();
  147. this.END = END.value();
  148. this.STATE = (State)STATE.value();
  149. this.SWITCH = SWITCH.value();
  150. }
  151. }
  152. }
  153. }