CutHole.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. /// <summary>
  49. /// 样品名
  50. /// </summary>
  51. private string m_SampleName;
  52. public string SampleName
  53. {
  54. get { return this.m_SampleName; }
  55. set { this.m_SampleName = value; }
  56. }
  57. #endregion
  58. #region 坐标位置
  59. private SemPosition m_Position;
  60. public SemPosition Position
  61. {
  62. get { return this.m_Position; }
  63. set { this.m_Position = value; }
  64. }
  65. #endregion
  66. #region 工作条件
  67. //是否有pt工序
  68. private Boolean m_pt;
  69. public Boolean PT
  70. {
  71. get { return this.m_pt; }
  72. set { this.m_pt = value; }
  73. }
  74. //FIB工作模板
  75. private string m_fibTemp;
  76. public string FIBTemp
  77. {
  78. get { return this.m_fibTemp; }
  79. set { this.m_fibTemp = value; }
  80. }
  81. //PT工作模板
  82. private string m_ptTemp;
  83. public string PTTemp
  84. {
  85. get { return this.m_ptTemp; }
  86. set { this.m_ptTemp = value; }
  87. }
  88. #endregion
  89. #region 工作状态
  90. //操作步骤
  91. private Operation m_opt;
  92. public Operation OPT
  93. {
  94. get { return this.m_opt; }
  95. set { this.m_opt = value; }
  96. }
  97. //开始时间
  98. private DateTime m_start;
  99. public DateTime START
  100. {
  101. get { return this.m_start; }
  102. set { this.m_start = value; }
  103. }
  104. //结束时间
  105. private DateTime m_end;
  106. public DateTime END
  107. {
  108. get { return this.m_end; }
  109. set { this.m_end = value; }
  110. }
  111. //测试结果
  112. private State m_state;
  113. public State STATE
  114. {
  115. get { return this.m_state; }
  116. set { this.m_state = value; }
  117. }
  118. //测量开关
  119. private bool m_switch;
  120. public bool SWITCH
  121. {
  122. get { return this.m_switch; }
  123. set { this.m_switch = value; }
  124. }
  125. #endregion
  126. //构造函数
  127. public CutHole()
  128. {
  129. Init();
  130. }
  131. //初始化函数
  132. private void Init()
  133. {
  134. //设定初始值
  135. m_opt = Operation.Init;
  136. m_state = State.Unmeasured;
  137. m_switch = false;
  138. Position = new SemPosition();
  139. }
  140. //样品孔存储xml文档
  141. public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
  142. {
  143. Slo<CutHole> slo_cuthole = new Slo<CutHole>();
  144. xString regName = new xString();
  145. regName.AssignValue("CutHole");
  146. slo_cuthole.Register("RegName", regName);
  147. //样品名称
  148. xString SampleName = new xString();
  149. SampleName.AssignValue(this.SampleName);
  150. slo_cuthole.Register("SampleName", SampleName);
  151. Slo<SemPosition> slo_sp = new Slo<SemPosition>();
  152. xDouble ptx = new xDouble();
  153. ptx.AssignValue(this.Position.X);
  154. slo_sp.Register("X", ptx);
  155. xDouble pty = new xDouble();
  156. pty.AssignValue(this.Position.X);
  157. slo_sp.Register("Y", pty);
  158. xDouble ptz = new xDouble();
  159. ptz.AssignValue(this.Position.Z);
  160. slo_sp.Register("Z", ptz);
  161. xDouble ptt = new xDouble();
  162. ptt.AssignValue(this.Position.T);
  163. slo_sp.Register("T", ptt);
  164. xDouble ptr = new xDouble();
  165. ptr.AssignValue(this.Position.R);
  166. slo_sp.Register("R", ptr);
  167. xDouble ptm = new xDouble();
  168. ptx.AssignValue(this.Position.M);
  169. slo_sp.Register("M", ptm);
  170. slo_cuthole.Register("Position", slo_sp);
  171. //是否有PT沉积
  172. xBool PT = new xBool();
  173. PT.AssignValue(this.PT);
  174. slo_cuthole.Register("PT", PT);
  175. //FIB工作模板
  176. xString FIBTemp = new xString();
  177. FIBTemp.AssignValue(this.FIBTemp);
  178. slo_cuthole.Register("FIBTemp", FIBTemp);
  179. //PT工作模板
  180. xString PTTemp = new xString();
  181. PTTemp.AssignValue(this.PTTemp);
  182. slo_cuthole.Register("PTTemp", PTTemp);
  183. //操作步骤
  184. xInt OPT = new xInt();
  185. OPT.AssignValue(this.OPT.GetHashCode());
  186. slo_cuthole.Register("OPT", OPT);
  187. //开始时间
  188. xTime_t START = new xTime_t();
  189. START.AssignValue(this.START);
  190. slo_cuthole.Register("START", START);
  191. //结束时间
  192. xTime_t END = new xTime_t();
  193. END.AssignValue(this.END);
  194. slo_cuthole.Register("END", END);
  195. //测量结果
  196. xInt STATE = new xInt();
  197. STATE.AssignValue(this.STATE.GetHashCode());
  198. slo_cuthole.Register("STATE", STATE);
  199. //测量开关
  200. xBool SWITCH = new xBool();
  201. SWITCH.AssignValue(this.SWITCH);
  202. slo_cuthole.Register("SWITCH", SWITCH);
  203. if (isStoring)
  204. {
  205. slo_cuthole.Serialize(true, xml, rootNode);
  206. }
  207. else
  208. {
  209. slo_cuthole.Serialize(false, xml, rootNode);
  210. this.SampleName = SampleName.value();
  211. this.PT = PT.value();
  212. this.FIBTemp = FIBTemp.value();
  213. this.PTTemp = PTTemp.value();
  214. this.OPT = (Operation)OPT.value();
  215. this.START = START.value();
  216. this.END = END.value();
  217. this.STATE = (State)STATE.value();
  218. this.SWITCH = SWITCH.value();
  219. this.Position.X = (float)ptx.value();
  220. this.Position.Y = (float)pty.value();
  221. this.Position.Z = (float)ptz.value();
  222. this.Position.T = (float)ptt.value();
  223. this.Position.R = (float)ptr.value();
  224. this.Position.M = (float)ptm.value();
  225. }
  226. }
  227. }
  228. }