ProgMgrInfoForm.cs 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using System.Text.RegularExpressions;
  6. using System.Collections;
  7. using System.Diagnostics;
  8. using OTSDataType;
  9. using OTSModelSharp;
  10. using System.IO;
  11. using static OTSModelSharp.ResourceManage.ResourceData;
  12. using static OTSDataType.otsdataconst;
  13. using OTSModelSharp.Measure.GetStageInfo;
  14. using OTSMeasureApp._3_OTSDisplaySourceGridData;
  15. namespace OTSMeasureApp
  16. {
  17. public partial class ProgMgrInfoForm :Form
  18. {
  19. #region 定义变量
  20. //初始化函数功能类
  21. public CStage m_cstage; //样品台类
  22. public CStageParam m_cstagefile; //样品台文件类
  23. public COTSDefaultParam m_cotsprogmgrparamfile; //参数类
  24. public CSEMStageData m_csemstagedata; //SEM样品台处理类
  25. public COTSImgScanPrm m_cotsimgscanprm; //图像扫描类
  26. public COTSGeneralParam m_cgenparam; //一般参数类
  27. public COTSImageProcParam m_cotsimgprocprm; //图像处理类
  28. public COTSXRayParam m_cotsxrayprm;
  29. public bool m_b_checkstagefile = false;
  30. //定位程序管理路径用的变量
  31. public string m_ParameterPath;
  32. frmMeasureStopMode StopModeDialog;
  33. //国际化
  34. OTSCommon.Language lan;
  35. Hashtable table;
  36. NLog.Logger log ;
  37. #endregion
  38. /// <summary>
  39. /// 样品台加载
  40. /// </summary>
  41. /// <returns></returns>
  42. public bool StageLoad()
  43. {
  44. if (!m_cstagefile.Load( true, !m_b_checkstagefile))
  45. {
  46. log.Error("(OTSProgMgrInfoFun.StageLoad) 加载样品台信息失败");
  47. return false;
  48. }
  49. return true;
  50. }
  51. #region 构造函数
  52. /// <summary>
  53. /// 默认构造函数
  54. /// </summary>
  55. public ProgMgrInfoForm()
  56. {
  57. log = NLog.LogManager.GetCurrentClassLogger();
  58. m_cotsprogmgrparamfile = new COTSDefaultParam();
  59. m_cstagefile = new CStageParam();
  60. InitializeComponent();
  61. //国际化
  62. lan = new OTSCommon.Language(this);
  63. table = lan.GetNameTable(this.Name);
  64. }
  65. #endregion
  66. #region 绑定各combobox控件
  67. /// <summary>
  68. /// 绑定各combobox控件下拉列表
  69. /// </summary>
  70. public void BindComboBox()
  71. {
  72. //样品台
  73. if (!StageLoad())
  74. {
  75. this.Close();
  76. return;//加载失败返回
  77. }
  78. //绑定样品台列表信息
  79. BindStageCombobox();
  80. //初始化选项,下拉框---------------------------------------------
  81. //绑定标准库
  82. IDC_COMBO_STDSelect.Items.Clear();
  83. string STDLibFolderName = m_cgenparam.GetPartSTDLibFolderName();
  84. string[] files = System.IO.Directory.GetFiles(STDLibFolderName, "*.db");
  85. System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(STDLibFolderName);
  86. foreach (System.IO.FileInfo file in folder.GetFiles("*.db"))
  87. {
  88. ComboBoxItem cbi = new ComboBoxItem();
  89. string FileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.FullName);
  90. cbi.Text = FileNameWithoutExtension;
  91. //cbi.Value = (int)enum_one;
  92. IDC_COMBO_STDSelect.Items.Add(cbi);
  93. }
  94. //添加下拉列表中null项
  95. ComboBoxItem cbiNull = new ComboBoxItem();
  96. cbiNull.Text = "NoSTDDB";
  97. //cbi.Value = (int)enum_one;
  98. IDC_COMBO_STDSelect.Items.Add(cbiNull);
  99. this.IDC_COMBO_STDSelect.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STDSelect_SelectedIndexChanged);
  100. if (IDC_COMBO_STDSelect.Items.Count > 0)
  101. IDC_COMBO_STDSelect.SelectedIndex = 0;
  102. //----------------------------------------------------------------------
  103. this.IDC_COMBO_STDSelect.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STDSelect_SelectedIndexChanged);
  104. //x轴方向
  105. IDC_COMBO_XDIREC.Items.Clear();
  106. foreach (otsdataconst.OTS_X_AXIS_DIRECTION enum_one in Enum.GetValues(typeof(otsdataconst.OTS_X_AXIS_DIRECTION)))
  107. {
  108. ComboBoxItem cbi = new ComboBoxItem();
  109. cbi.Text = GetXAxisDirectionIdString(enum_one);
  110. cbi.Value = (int)enum_one;
  111. IDC_COMBO_XDIREC.Items.Add(cbi);
  112. }
  113. this.IDC_COMBO_XDIREC.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_XDIREC_SelectedIndexChanged);
  114. if (IDC_COMBO_XDIREC.Items.Count > 0)
  115. IDC_COMBO_XDIREC.SelectedIndex = 0;
  116. this.IDC_COMBO_XDIREC.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_XDIREC_SelectedIndexChanged);
  117. //y轴方向
  118. IDC_COMBO_YDIRECT.Items.Clear();
  119. foreach (otsdataconst.OTS_Y_AXIS_DIRECTION enum_one in Enum.GetValues(typeof(otsdataconst.OTS_Y_AXIS_DIRECTION)))
  120. {
  121. ComboBoxItem cbi = new ComboBoxItem();
  122. cbi.Text = GetYAxisDirectionIdString(enum_one);
  123. cbi.Value = (int)enum_one;
  124. IDC_COMBO_YDIRECT.Items.Add(cbi);
  125. }
  126. this.IDC_COMBO_YDIRECT.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);
  127. if (IDC_COMBO_YDIRECT.Items.Count > 0)
  128. IDC_COMBO_YDIRECT.SelectedIndex = 0;
  129. this.IDC_COMBO_YDIRECT.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);
  130. //取图方式
  131. IDC_COMBO_FETCHIMGMODE.Items.Clear();
  132. foreach (otsdataconst.OTS_GET_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_GET_IMAGE_MODE)))
  133. {
  134. ComboBoxItem cbi = new ComboBoxItem();
  135. cbi.Text = GetGetImageIdString(enum_one);
  136. cbi.Value = (int)enum_one;
  137. IDC_COMBO_FETCHIMGMODE.Items.Add(cbi);
  138. }
  139. this.IDC_COMBO_FETCHIMGMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged);
  140. if (IDC_COMBO_FETCHIMGMODE.Items.Count > 0)
  141. IDC_COMBO_FETCHIMGMODE.SelectedIndex = 0;
  142. this.IDC_COMBO_FETCHIMGMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged);
  143. //扫描图精度
  144. IDC_COMBO_IMGSCANSPEED.Items.Clear();
  145. foreach (otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)))
  146. {
  147. ComboBoxItem cbi = new ComboBoxItem();
  148. cbi.Text = GetScanSpeedString(enum_one);
  149. cbi.Value = (int)enum_one;
  150. IDC_COMBO_IMGSCANSPEED.Items.Add(cbi);
  151. }
  152. this.IDC_COMBO_IMGSCANSPEED.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged);
  153. if (IDC_COMBO_IMGSCANSPEED.Items.Count > 0)
  154. IDC_COMBO_IMGSCANSPEED.SelectedIndex = 0;
  155. this.IDC_COMBO_IMGSCANSPEED.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged);
  156. //扫描图尺寸
  157. IDC_COMBO_IMGSIZE.Items.Clear();
  158. foreach (otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)))
  159. {
  160. ComboBoxItem cbi = new ComboBoxItem();
  161. cbi.Text = GetImageSizeIdString(enum_one);
  162. cbi.Value = (int)enum_one;
  163. IDC_COMBO_IMGSIZE.Items.Add(cbi);
  164. }
  165. this.IDC_COMBO_IMGSIZE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_IMGSIZE_SelectedIndexChanged);
  166. if (IDC_COMBO_IMGSIZE.Items.Count > 0)
  167. IDC_COMBO_IMGSIZE.SelectedIndex = 0;
  168. this.IDC_COMBO_IMGSIZE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_IMGSIZE_SelectedIndexChanged);
  169. //去背景方式
  170. IDC_COMBO_BGREMOVETYPE.Items.Clear();
  171. foreach (otsdataconst.OTS_AUTOBGREMOVETYPE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_AUTOBGREMOVETYPE)))
  172. {
  173. ComboBoxItem cbi = new ComboBoxItem();
  174. cbi.Text = GetBGREMOVETYPEString(enum_one);
  175. cbi.Value = (int)enum_one;
  176. IDC_COMBO_BGREMOVETYPE.Items.Add(cbi);
  177. }
  178. this.IDC_COMBO_BGREMOVETYPE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged);
  179. if (IDC_COMBO_BGREMOVETYPE.Items.Count > 0)
  180. IDC_COMBO_BGREMOVETYPE.SelectedIndex = 0;
  181. this.IDC_COMBO_BGREMOVETYPE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged);
  182. //自动去背景方式
  183. IDC_COMBO_AUTOBGREMOVETYP.Items.Clear();
  184. foreach (otsdataconst.OTS_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_MODE)))
  185. {
  186. ComboBoxItem cbi = new ComboBoxItem();
  187. cbi.Text = GetAUTOBGREMOVETYPEString(enum_one);
  188. cbi.Value = (int)enum_one;
  189. IDC_COMBO_AUTOBGREMOVETYP.Items.Add(cbi);
  190. }
  191. this.IDC_COMBO_AUTOBGREMOVETYP.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged);
  192. if (IDC_COMBO_AUTOBGREMOVETYP.Items.Count > 0)
  193. IDC_COMBO_AUTOBGREMOVETYP.SelectedIndex = 0;
  194. this.IDC_COMBO_AUTOBGREMOVETYP.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged);
  195. //腐蚀膨胀系数
  196. //IDC_COMBO_CorrosionExpansionCoefficient.Items.Clear();
  197. //ComboBoxItem ci = new ComboBoxItem();
  198. //ci.Text = "0";
  199. //ci.Value = 0;
  200. //IDC_COMBO_CorrosionExpansionCoefficient.Items.Add(ci);
  201. //for (int i=1;i<6;i++)
  202. //{
  203. // ComboBoxItem cbi = new ComboBoxItem();
  204. // cbi.Text = (i*2+1).ToString();
  205. // cbi.Value = i;
  206. // IDC_COMBO_CorrosionExpansionCoefficient.Items.Add(cbi);
  207. //}
  208. //X-Ray扫描方式
  209. IDC_COMBO_XRAYSCANMODE.Items.Clear();
  210. foreach (otsdataconst.OTS_X_RAY_SCAN_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_X_RAY_SCAN_MODE)))
  211. {
  212. ComboBoxItem cbi = new ComboBoxItem();
  213. cbi.Text = GetXRayScanModeIdString(enum_one);
  214. cbi.Value = (int)enum_one;
  215. //只添加点扫描
  216. IDC_COMBO_XRAYSCANMODE.Items.Add(cbi);
  217. }
  218. this.IDC_COMBO_XRAYSCANMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged);
  219. if (IDC_COMBO_XRAYSCANMODE.Items.Count > 0)
  220. IDC_COMBO_XRAYSCANMODE.SelectedIndex = 0;
  221. this.IDC_COMBO_XRAYSCANMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged);
  222. //分析X-Ray精度
  223. IDC_COMBO_ANALYXRAYSPEED.Items.Clear();
  224. foreach (otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)))
  225. {
  226. ComboBoxItem cbi = new ComboBoxItem();
  227. cbi.Text = GetXRayAnalySpeedIdString(enum_one);
  228. cbi.Value = (int)enum_one;
  229. IDC_COMBO_ANALYXRAYSPEED.Items.Add(cbi);
  230. }
  231. this.IDC_COMBO_ANALYXRAYSPEED.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged);
  232. if (IDC_COMBO_ANALYXRAYSPEED.Items.Count > 0)
  233. IDC_COMBO_ANALYXRAYSPEED.SelectedIndex = 0;
  234. this.IDC_COMBO_ANALYXRAYSPEED.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged);
  235. //精炼工艺下拉框选项
  236. IDC_COMBO_TECHNOLOGY.Items.Clear();
  237. foreach (STEEL_TECHNOLOGY enum_one in Enum.GetValues(typeof(STEEL_TECHNOLOGY)))
  238. {
  239. ComboBoxItem cbi = new ComboBoxItem();
  240. cbi.Text = GetSteelTechIdString((otsdataconst.STEEL_TECHNOLOGY)enum_one);
  241. cbi.Value = (int)enum_one;
  242. IDC_COMBO_TECHNOLOGY.Items.Add(cbi);
  243. }
  244. this.IDC_COMBO_TECHNOLOGY.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_TECHNOLOGY_SelectedIndexChanged);
  245. if (IDC_COMBO_TECHNOLOGY.Items.Count > 0)
  246. IDC_COMBO_TECHNOLOGY.SelectedIndex = 0;
  247. this.IDC_COMBO_TECHNOLOGY.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_TECHNOLOGY_SelectedIndexChanged);
  248. //测量区域形状
  249. cBMeasShape.Items.Clear();
  250. foreach (otsdataconst.MEASURE_SHAPE enum_one in Enum.GetValues(typeof(otsdataconst.MEASURE_SHAPE)))
  251. {
  252. ComboBoxItem cbi = new ComboBoxItem();
  253. cbi.Text = GetAreaShapeString(enum_one);
  254. cbi.Value = (int)enum_one;
  255. cBMeasShape.Items.Add(cbi);
  256. }
  257. this.cBMeasShape.SelectedIndexChanged -= new System.EventHandler(this.cBMeasShape_SelectedIndexChanged);
  258. if (cBMeasShape.Items.Count > 0)
  259. cBMeasShape.SelectedIndex = 0;
  260. this.cBMeasShape.SelectedIndexChanged += new System.EventHandler(this.cBMeasShape_SelectedIndexChanged);
  261. //模式选择
  262. IDC_COMBO_Model.Items.Clear();
  263. foreach (otsdataconst.RunMode enum_one in Enum.GetValues(typeof(otsdataconst.RunMode)))
  264. {
  265. OTSPeriodicTable.ComboBoxItem cbi = new OTSPeriodicTable.ComboBoxItem();
  266. cbi.Text = GetRunModeString(enum_one);
  267. cbi.Value = (int)enum_one;
  268. IDC_COMBO_Model.Items.Add(cbi);
  269. }
  270. this.IDC_COMBO_Model.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_Model_SelectedIndexChanged);
  271. if (IDC_COMBO_Model.Items.Count > 0)
  272. IDC_COMBO_Model.SelectedIndex = 0;
  273. this.IDC_COMBO_Model.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_Model_SelectedIndexChanged);
  274. }
  275. public CStage GetWorkingStage()
  276. {
  277. CStage ls_cstageclr = m_cstagefile.GetWorkingStage();
  278. if (null == ls_cstageclr)
  279. {
  280. log.Error("(OTSProgMgrInfoFun.GetWorkingStage) 获取正在工作的样品台类失败");
  281. return ls_cstageclr;
  282. }
  283. return ls_cstageclr;
  284. }
  285. /// <summary>
  286. /// 获取正在工作的样品台ID
  287. /// </summary>
  288. /// <returns></returns>
  289. public int GetWorkingStageId()
  290. {
  291. int stageid = m_cstagefile.GetWorkingStageId();
  292. return stageid;
  293. }
  294. /// <summary>
  295. /// 获取样品台信息列表
  296. /// </summary>
  297. /// <returns></returns>
  298. public List<CStage> GetStageList()
  299. {
  300. List<CStage> l_cstageclr = m_cstagefile.GetStagesList();
  301. if (null == l_cstageclr)
  302. {
  303. log.Error("(OTSProgMgrInfoFun.GetStageList) 获取样品台信息列表失败");
  304. return l_cstageclr;
  305. }
  306. return l_cstageclr;
  307. }
  308. /// <summary>
  309. /// 绑定样品台列表信息
  310. /// </summary>
  311. private void BindStageCombobox()
  312. {
  313. //先插入正在工作的样品台
  314. int ls_workingstageid = 0;
  315. IDC_COMBO_STAGE.Items.Clear();
  316. CStage ls_cstageclr = GetWorkingStage();
  317. ComboBoxItem ls_cbi = new ComboBoxItem();
  318. ls_cbi.Text = ls_cstageclr.GetName();
  319. ls_workingstageid = GetWorkingStageId();
  320. ls_cbi.Value = ls_workingstageid;
  321. IDC_COMBO_STAGE.Items.Add(ls_cbi);
  322. //添加其它的样品台信息
  323. List<CStage> l_cstageclr = GetStageList();
  324. for (int i = 0; i < l_cstageclr.Count(); i++)
  325. {
  326. if (ls_workingstageid != i)//将已经插入过的正在工作样品台信息跳过去
  327. {
  328. ComboBoxItem cbi = new ComboBoxItem();
  329. cbi.Text = l_cstageclr[i].GetName().ToString();
  330. cbi.Value = i.ToString();
  331. IDC_COMBO_STAGE.Items.Add(cbi);
  332. }
  333. }
  334. //防止进入窗体后,马上进入下拉项选择事件,先把事件去掉,一会再注册上
  335. this.IDC_COMBO_STAGE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STAGE_SelectedIndexChanged);
  336. //默认选择上
  337. if (IDC_COMBO_STAGE.Items.Count > 0)
  338. {
  339. IDC_COMBO_STAGE.SelectedIndex = 0;
  340. }
  341. this.IDC_COMBO_STAGE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STAGE_SelectedIndexChanged);
  342. }
  343. #endregion
  344. #region 参数相关方法封装
  345. /// <summary>
  346. /// 读取SEM样品台参数信息
  347. /// </summary>
  348. public void LoadSEMStageData()
  349. {
  350. //100倍时屏幕尺寸/mm
  351. IDC_EDIT_SCREENWIDTH.Text = m_csemstagedata.GetScanFieldSize100().ToString();
  352. //x轴方向
  353. foreach (ComboBoxItem cbi in IDC_COMBO_XDIREC.Items)
  354. {
  355. if (cbi.Value.ToString() != "")
  356. if (Convert.ToInt32(cbi.Value) == (int)m_csemstagedata.GetXAxisDir())
  357. {
  358. IDC_COMBO_XDIREC.SelectedItem = cbi;
  359. }
  360. }
  361. //x轴行程/mm 起,取值时,乘1000
  362. IDC_EDIT_XSTART.Text = (m_csemstagedata.GetXAxis().GetStart() / 1000).ToString();
  363. //x轴行程/mm 始
  364. IDC_EDIT_XEND.Text = (m_csemstagedata.GetXAxis().GetEnd() / 1000).ToString();
  365. //y轴方向
  366. foreach (ComboBoxItem cbi in IDC_COMBO_YDIRECT.Items)
  367. {
  368. if (cbi.Value.ToString() != "")
  369. if (Convert.ToInt32(cbi.Value) == (int)m_csemstagedata.GetYAxisDir())
  370. {
  371. IDC_COMBO_YDIRECT.SelectedItem = cbi;
  372. }
  373. }
  374. //y轴行程/mm 起
  375. IDC_EDIT_YSTART.Text = (m_csemstagedata.GetYAxis().GetStart() / 1000).ToString();
  376. //y轴行程/mm 始
  377. IDC_EDIT_YEND.Text = (m_csemstagedata.GetYAxis().GetEnd() / 1000).ToString();
  378. //最小放大倍数
  379. IDC_EDIT_MINMAG.Text = m_csemstagedata.GetMinMag().ToString();
  380. }
  381. /// <summary>
  382. /// 加载图像扫描参数
  383. /// </summary>
  384. public void LoadImageScanPrm()
  385. {
  386. //测量终止方式
  387. tB_StopMode.Text = m_cotsimgscanprm.GetStopMode().ToString();
  388. if (StopModeDialog == null)
  389. {
  390. StopModeDialog = new frmMeasureStopMode();
  391. StopModeDialog.FieldMode = m_cotsimgscanprm.GetStopParamFields();
  392. StopModeDialog.TimeMode = m_cotsimgscanprm.GetStopParamMeasTime();
  393. StopModeDialog.ParticleMode = m_cotsimgscanprm.GetStopParamParticles();
  394. StopModeDialog.AreaMode = m_cotsimgscanprm.GetStopParamArea();
  395. StopModeDialog.StopMode = tB_StopMode.Text;
  396. }
  397. //取图方式
  398. foreach (ComboBoxItem cbi in IDC_COMBO_FETCHIMGMODE.Items)
  399. {
  400. if (cbi.Value.ToString() != "")
  401. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetFieldStartMode())
  402. {
  403. IDC_COMBO_FETCHIMGMODE.SelectedItem = cbi;
  404. }
  405. }
  406. //扫描图精度
  407. foreach (ComboBoxItem cbi in IDC_COMBO_IMGSCANSPEED.Items)
  408. {
  409. if (cbi.Value.ToString() != "")
  410. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetScanImageSpeed())
  411. {
  412. IDC_COMBO_IMGSCANSPEED.SelectedItem = cbi;
  413. }
  414. }
  415. //扫描图尺寸
  416. foreach (ComboBoxItem cbi in IDC_COMBO_IMGSIZE.Items)
  417. {
  418. if (cbi.Value.ToString() != "")
  419. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetImageResulotion())
  420. {
  421. IDC_COMBO_IMGSIZE.SelectedItem = cbi;
  422. }
  423. }
  424. }
  425. /// <summary>
  426. /// 加载一般常规参数
  427. /// </summary>
  428. public void LoadCGenParam()
  429. {
  430. //样品名
  431. IDC_EDIT_SAMPLENAME.Text = m_cgenparam.GetSampleName().ToString();
  432. //执行开关
  433. IDC_MEAS_SWITCH.Checked = m_cgenparam.GetMeasurementSwitch();
  434. //是否使用系统库开关
  435. IDC_SYS_LIB.Checked = m_cgenparam.GetSysSTD();
  436. //测量参数文件夹
  437. IDC_EDIT_MEASUREPARAMPATH.Text = m_cgenparam.GetMsrParamFileFolderName().ToString();
  438. //颗粒分析标准库文件夹
  439. IDC_EDIT_ANALYSESTDLIBPATH.Text = m_cgenparam.GetPartSTDLibFolderName().ToString();
  440. //选择颗粒分析标准库
  441. foreach (ComboBoxItem cbi in IDC_COMBO_TECHNOLOGY.Items)
  442. {
  443. if (cbi.Value.ToString() != "")
  444. if (Convert.ToInt32(cbi.Value) == m_cgenparam.GetPartStdLibTypeIndex())
  445. {
  446. IDC_COMBO_TECHNOLOGY.SelectedItem = cbi;
  447. }
  448. }
  449. //精炼工艺选项
  450. foreach (ComboBoxItem cbi in IDC_COMBO_TECHNOLOGY.Items)
  451. {
  452. if (cbi.Value.ToString() != "")
  453. if (Convert.ToInt32(cbi.Value) == m_cgenparam.GetSteelTechnology())
  454. {
  455. IDC_COMBO_TECHNOLOGY.SelectedItem = cbi;
  456. }
  457. }
  458. //测量区域形状
  459. foreach (ComboBoxItem cbi in cBMeasShape.Items)
  460. {
  461. if (cbi.Value.ToString() != "")
  462. if (Convert.ToInt32(cbi.Value) == (int)m_cgenparam.GetShape())
  463. {
  464. cBMeasShape.SelectedItem = cbi;
  465. }
  466. }
  467. //测量区域面积
  468. tBMeasArea.Text = m_cgenparam.GetArea().ToString();
  469. //标准库选择
  470. foreach (ComboBoxItem cbi in IDC_COMBO_STDSelect.Items)
  471. {
  472. if (cbi.Text.ToString() != "")
  473. if (cbi.Text.ToString() == m_cgenparam.GetSTDSelect())
  474. {
  475. IDC_COMBO_STDSelect.SelectedItem = cbi;
  476. }
  477. }
  478. }
  479. /// <summary>
  480. /// 加载默认参数
  481. /// </summary>
  482. public void LoadDefaultParam()
  483. {
  484. //模式
  485. foreach (OTSPeriodicTable.ComboBoxItem cbi in IDC_COMBO_Model.Items)
  486. {
  487. if (cbi.Value.ToString() != "")
  488. if (Convert.ToInt32(cbi.Value) == (int)m_cotsprogmgrparamfile.GetRunMode())
  489. {
  490. IDC_COMBO_Model.SelectedItem = cbi;
  491. }
  492. }
  493. }
  494. /// <summary>
  495. /// 加载图像处理参数
  496. /// </summary>
  497. public void LoadImageProc()
  498. {
  499. //颗粒面积范围 最小
  500. IDC_EDIT_PARTAREAMIN.Text = m_cotsimgprocprm.GetIncAreaRange().GetStart().ToString();
  501. //颗粒面积范围 最大
  502. IDC_EDIT_PARTAREAMAX.Text = m_cotsimgprocprm.GetIncAreaRange().GetEnd().ToString();
  503. //背景灰度范围 最小
  504. IDC_EDIT_BACKMIN.Text = m_cotsimgprocprm.GetBGGray().GetStart().ToString();
  505. //背景灰度范围 最大
  506. IDC_EDIT_BACKMAX.Text = m_cotsimgprocprm.GetBGGray().GetEnd().ToString();
  507. //颗粒灰度范围 最小
  508. IDC_EDIT_PARTMIN.Text = m_cotsimgprocprm.GetParticleGray().GetStart().ToString();
  509. //颗粒灰度范围 最大
  510. IDC_EDIT_PARTMAX.Text = m_cotsimgprocprm.GetParticleGray().GetEnd().ToString();
  511. //腐蚀膨胀系数
  512. //IDC_COMBO_CorrosionExpansionCoefficient.Text = m_cotsimgprocprm.GetErrodDilateParam().ToString();
  513. //重叠尺寸
  514. IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();
  515. //去背景方式
  516. foreach (ComboBoxItem cbi in IDC_COMBO_BGREMOVETYPE.Items)
  517. {
  518. if (cbi.Value.ToString() != "")
  519. {
  520. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetBGRemoveType())
  521. {
  522. IDC_COMBO_BGREMOVETYPE.SelectedItem = cbi;
  523. break;
  524. }
  525. }
  526. }
  527. foreach (ComboBoxItem cbi in IDC_COMBO_AUTOBGREMOVETYP.Items)
  528. {
  529. if (cbi.Value.ToString() != "")
  530. {
  531. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetAutoBGRemoveType())
  532. {
  533. IDC_COMBO_AUTOBGREMOVETYP.SelectedItem = cbi;
  534. break;
  535. }
  536. }
  537. }
  538. //重叠尺寸
  539. IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();
  540. }
  541. /// <summary>
  542. /// 加载X-Ray参数
  543. /// </summary>
  544. public void LoadXRayParam()
  545. {
  546. //搜索X-ray精度对应的时间
  547. //IDC_TEXTBOX_SEARCHXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidSearchAQTime().ToString();
  548. foreach (ComboBoxItem cbi in IDC_COMBO_XRAYSCANMODE.Items)
  549. {
  550. if (cbi.Value.ToString() != "")
  551. if (Convert.ToInt32(cbi.Value) == (int)m_cotsxrayprm.GetScanMode())
  552. {
  553. IDC_COMBO_XRAYSCANMODE.SelectedItem = cbi;
  554. }
  555. }
  556. //是否使用电镜
  557. IDC_USINGXRAY_LIB.Checked = m_cotsxrayprm.GetUsingXray();
  558. //分析X-ray精度对应的时间
  559. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidAnalyAQTime().ToString();
  560. //分析X-ray计数期望值
  561. IDC_EDIT_ANALYXRAYAIMVALUE.Text = m_cotsxrayprm.GetAnalyExpCount().ToString();
  562. IDC_EDIT_QuantifyMinSize.Text = m_cotsxrayprm.GetFeatureModeMinSize().ToString();
  563. IDC_EDIT_SmallPartAQTime.Text = m_cotsxrayprm.GetSmallPartXrayTime().ToString();
  564. IDC_EDIT_XrayLimit.Text = m_cotsxrayprm.GetXrayLimit().ToString();
  565. IDC_FILTER.Checked = m_cotsxrayprm.GetUseFilter();
  566. }
  567. /// <summary>
  568. /// 保存SEM样品台参数
  569. /// </summary>
  570. public void SaveSEMStageData()
  571. {
  572. //100倍时屏幕尺寸/mm
  573. m_csemstagedata.SetScanFieldSize100(Convert.ToInt32(IDC_EDIT_SCREENWIDTH.Text));
  574. //x轴方向
  575. ComboBoxItem cbi_x = (ComboBoxItem)IDC_COMBO_XDIREC.SelectedItem;
  576. m_csemstagedata.SetXAxisDir((otsdataconst.OTS_X_AXIS_DIRECTION)Convert.ToInt32(cbi_x.Value));
  577. //x轴行程/mm 起,始
  578. CIntRange crc_x = new CIntRange(Convert.ToInt32(IDC_EDIT_XSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_XEND.Text) * 1000);
  579. m_csemstagedata.SetXAxis(crc_x);
  580. //y轴方向
  581. ComboBoxItem cbi_y = (ComboBoxItem)IDC_COMBO_YDIRECT.SelectedItem;
  582. m_csemstagedata.SetYAxisDir((otsdataconst.OTS_Y_AXIS_DIRECTION)Convert.ToInt32(cbi_y.Value));
  583. //y轴行程/mm 起,始
  584. CIntRange crc_y = new CIntRange(Convert.ToInt32(IDC_EDIT_YSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_YEND.Text) * 1000);
  585. m_csemstagedata.SetYAxis(crc_y);
  586. //最小放大倍数
  587. m_csemstagedata.SetMinMag(Convert.ToDouble(IDC_EDIT_MINMAG.Text));
  588. }
  589. /// <summary>
  590. /// 保存图像扫描参数
  591. /// </summary>
  592. public void SaveImageScanPrm()
  593. {
  594. // 保存图像扫描参数");
  595. //测量终止方式
  596. m_cotsimgscanprm.SetStopMode(tB_StopMode.Text);
  597. //终止时间
  598. m_cotsimgscanprm.SetStopParamMeasTime(StopModeDialog.TimeMode);
  599. ////终止帧图数
  600. m_cotsimgscanprm.SetStopParamFields(StopModeDialog.FieldMode);
  601. ////终止夹杂物数
  602. m_cotsimgscanprm.SetStopParamParticles(StopModeDialog.ParticleMode);
  603. ////终止面积
  604. m_cotsimgscanprm.SetStopParamArea(StopModeDialog.AreaMode);
  605. //取图方式
  606. ComboBoxItem enum_fetchimgmode = (ComboBoxItem)IDC_COMBO_FETCHIMGMODE.SelectedItem;
  607. m_cotsimgscanprm.SetStartImageMode((otsdataconst.OTS_GET_IMAGE_MODE)Convert.ToInt32(enum_fetchimgmode.Value));
  608. //扫描图精度
  609. ComboBoxItem enum_imgscanspeed = (ComboBoxItem)IDC_COMBO_IMGSCANSPEED.SelectedItem;
  610. m_cotsimgscanprm.SetScanImageSpeed((otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)Convert.ToInt32(enum_imgscanspeed.Value));
  611. //扫描图尺寸
  612. ComboBoxItem enum_imgsize = (ComboBoxItem)IDC_COMBO_IMGSIZE.SelectedItem;
  613. m_cotsimgscanprm.SetImageResulotion((otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)Convert.ToInt32(enum_imgsize.Value));
  614. }
  615. /// <summary>
  616. /// 保存一般常规参数
  617. /// </summary>
  618. public void SaveCGenParam()
  619. {
  620. //样品名
  621. m_cgenparam.SetSampleName(IDC_EDIT_SAMPLENAME.Text);
  622. //执行开关
  623. m_cgenparam.SetMeasurementSwitch(IDC_MEAS_SWITCH.Checked);
  624. //是否使用系统库
  625. m_cgenparam.SetSysSTD(IDC_SYS_LIB.Checked);
  626. //测量参数文件夹
  627. m_cgenparam.SetMsrParamFileFolderName(IDC_EDIT_MEASUREPARAMPATH.Text);
  628. //颗粒分析标准库文件夹
  629. m_cgenparam.SetPartSTDLibFolderName(IDC_EDIT_ANALYSESTDLIBPATH.Text);
  630. //获取精炼工艺索引
  631. ComboBoxItem cbiTECH = new ComboBoxItem();
  632. cbiTECH = (ComboBoxItem)IDC_COMBO_TECHNOLOGY.SelectedItem;
  633. //设置参数文件类中精炼工艺索引值
  634. m_cgenparam.SetSteelTechnology((int)cbiTECH.Value);
  635. //测量区域形状
  636. ComboBoxItem enum_Shape = (ComboBoxItem)cBMeasShape.SelectedItem;
  637. m_cgenparam.SetShape((otsdataconst.DOMAIN_SHAPE)Convert.ToInt32(enum_Shape.Value));
  638. //测量区域大小
  639. m_cgenparam.SetArea(Convert.ToDouble(tBMeasArea.Text));
  640. //标准库选择
  641. ComboBoxItem enum_STDLIBSELECT = (ComboBoxItem)IDC_COMBO_STDSelect.SelectedItem;
  642. m_cgenparam.SetSTDSelect(enum_STDLIBSELECT.Text.ToString());
  643. }
  644. /// <summary>
  645. /// 保存图像处理参数
  646. /// </summary>
  647. public void SaveImageProc()
  648. {
  649. //颗粒面积范围 最小 最大
  650. CDoubleRange crc_partareamin = new CDoubleRange(Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text), 2), Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text), 2));
  651. m_cotsimgprocprm.SetIncAreaRange(crc_partareamin);
  652. //背景灰度范围 最小 最大
  653. CIntRange crc_backmin = new CIntRange(Convert.ToInt32(IDC_EDIT_BACKMIN.Text), Convert.ToInt32(IDC_EDIT_BACKMAX.Text));
  654. m_cotsimgprocprm.SetBGGray(crc_backmin);
  655. //颗粒灰度范围 最小 最大
  656. CIntRange crc_partmin = new CIntRange(Convert.ToInt32(IDC_EDIT_PARTMIN.Text), Convert.ToInt32(IDC_EDIT_PARTMAX.Text));
  657. m_cotsimgprocprm.SetParticleGray(crc_partmin);
  658. //去背景方式
  659. ComboBoxItem enum_BGREMOVETYPE = (ComboBoxItem)IDC_COMBO_BGREMOVETYPE.SelectedItem;
  660. m_cotsimgprocprm.SetBGRemoveType((otsdataconst.OTS_BGREMOVE_TYPE)enum_BGREMOVETYPE.Value);
  661. //去背景方式
  662. ComboBoxItem enum_AUTOBGREMOVETYP = (ComboBoxItem)IDC_COMBO_AUTOBGREMOVETYP.SelectedItem;
  663. m_cotsimgprocprm.SetAutoBGRemoveType((otsdataconst.OTS_AUTOBGREMOVE_TYPE)enum_AUTOBGREMOVETYP.Value);
  664. //腐蚀膨胀系数
  665. //m_cotsimgprocprm.SetErrodDilateParam(Convert.ToInt32(IDC_COMBO_CorrosionExpansionCoefficient.Text));
  666. //重叠像素
  667. m_cotsimgprocprm.SetOverlapParam(Convert.ToInt32(IDC_EDIT_Overlap.Text));
  668. }
  669. /// <summary>
  670. /// 保存X-Ray参数
  671. /// </summary>
  672. public void SaveXRayParam()
  673. {
  674. //搜索X-ray精度
  675. ComboBoxItem enum_searchxrayspeed = (ComboBoxItem)IDC_COMBO_SEARCHXRAYSPEED.SelectedItem;
  676. //X-ray扫描方式
  677. ComboBoxItem enum_xrayscanmode = (ComboBoxItem)IDC_COMBO_XRAYSCANMODE.SelectedItem;
  678. m_cotsxrayprm.SetScanMode((otsdataconst.OTS_X_RAY_SCAN_MODE)Convert.ToInt32(enum_xrayscanmode.Value));
  679. //是否使用X-ray
  680. m_cotsxrayprm.SetUsingXray(IDC_USINGXRAY_LIB.Checked);
  681. //分析X-ray精度对应的时间
  682. m_cotsxrayprm.SetMidAnalyAQTime(Convert.ToInt32(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()));
  683. //分析X-ray计数期望值
  684. m_cotsxrayprm.SetAnalyExpCount(Convert.ToInt32(IDC_EDIT_ANALYXRAYAIMVALUE.Text));
  685. m_cotsxrayprm.SetQuantifyMinSize(Convert.ToDouble(IDC_EDIT_QuantifyMinSize.Text));
  686. m_cotsxrayprm.SetSmallPartXrayTime(Convert.ToInt32(IDC_EDIT_SmallPartAQTime.Text));
  687. m_cotsxrayprm.SetXrayLimit(Convert.ToInt32(IDC_EDIT_XrayLimit.Text));
  688. m_cotsxrayprm.SetUseFilter(IDC_FILTER.Checked);
  689. }
  690. /// <summary>
  691. /// 将参数保存到文件
  692. /// </summary>
  693. /// <param name="a_nPackId"></param>
  694. /// <param name="a_pStageData"></param>
  695. /// <param name="a_pGenParam"></param>
  696. /// <param name="a_pImageScanParam"></param>
  697. /// <param name="a_pImageProcParam"></param>
  698. /// <param name="a_pXRayParam"></param>
  699. /// <returns></returns>
  700. public bool SaveInfoToProgMgrFile()
  701. {
  702. //SaveInfoToProgMgrFile()
  703. if (false == m_cotsprogmgrparamfile.SaveInfoToProgMgrFile())
  704. {
  705. log.Error("(OTSProgMgrInfoFun.SaveInfoToProgMgrFile) Failed to save parameters to file");
  706. return false;
  707. }
  708. return true;
  709. }
  710. /// <summary>
  711. /// 加载参数各个类
  712. /// </summary>
  713. public bool LoadParamFun()
  714. {
  715. bool result = m_cotsprogmgrparamfile.LoadInfoFromProgMgrFile();
  716. if (!result)
  717. {
  718. log.Error("(OTSProgMgrInfoFun.LoadParamFun) LoadInfoFromProgMgrFile Failed");
  719. return false;
  720. }
  721. m_csemstagedata = m_cotsprogmgrparamfile.GetStageDataParam();
  722. if (null == m_csemstagedata)
  723. {
  724. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetStageData Failed");
  725. return false;
  726. }
  727. m_cotsimgscanprm = m_cotsprogmgrparamfile.GetImageScanParam();
  728. if (null == m_cotsimgscanprm)
  729. {
  730. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetImageScanParam Failed");
  731. return false;
  732. }
  733. m_cgenparam = m_cotsprogmgrparamfile.GetGenParam();
  734. if (null == m_cgenparam)
  735. {
  736. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetGenParam Failed");
  737. return false;
  738. }
  739. m_cotsimgprocprm = m_cotsprogmgrparamfile.GetImageProcParam();
  740. if (null == m_cotsimgprocprm)
  741. {
  742. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetImageProcParam Failed");
  743. return false;
  744. }
  745. m_cotsxrayprm = m_cotsprogmgrparamfile.GetXRayParam();
  746. if (null == m_cotsxrayprm)
  747. {
  748. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetXRayParam Failed");
  749. return false;
  750. }
  751. return true;
  752. }
  753. #endregion
  754. #region 窗体加载
  755. private void ProgMgrInfoForm_Load(object sender, EventArgs e)
  756. {
  757. //加载各参数类
  758. LoadParamFun();
  759. //初始化combobox下拉框列表
  760. BindComboBox();
  761. //加载相关参数信息
  762. LoadDefaultParam();
  763. LoadSEMStageData();
  764. LoadImageScanPrm();
  765. LoadCGenParam();
  766. LoadImageProc();
  767. LoadXRayParam();
  768. if (m_b_checkstagefile == false)
  769. btnok.Enabled = true;
  770. else
  771. btnok.Enabled = false;
  772. //获取特殊颗粒信息
  773. //DataTable dt = XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0];
  774. //if (dt.Rows.Count != 0)
  775. //{
  776. // if (XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0].Rows[0]["ToRun"].ToString() == "true")
  777. // {
  778. // checkBox_Run.Checked = true;
  779. // }
  780. // else
  781. // {
  782. // checkBox_Run.Checked = false;
  783. // }
  784. //}
  785. //关于路径定位问题
  786. this.folderBrowserDialog1.SelectedPath = IDC_EDIT_MEASUREPARAMPATH.Text;
  787. string strb = ".\\Config\\SysData\\";
  788. string strc = ".\\Config\\ProData\\";
  789. string m_STDPath = strb;
  790. m_ParameterPath = strc;
  791. this.folderBrowserDialog1.SelectedPath = m_ParameterPath;
  792. IDC_EDIT_MEASUREPARAMPATH.Text = m_ParameterPath;
  793. IDC_EDIT_ANALYSESTDLIBPATH.Text = m_STDPath;
  794. if(m_cotsprogmgrparamfile.GetSysTypeName() == "IncA")
  795. {
  796. label42.Visible = true;
  797. IDC_COMBO_TECHNOLOGY.Visible = true;
  798. }
  799. else
  800. {
  801. label42.Visible = false;
  802. IDC_COMBO_TECHNOLOGY.Visible = false;
  803. }
  804. }
  805. #endregion
  806. #region 各按钮控件点击事件
  807. private void IDC_BUTTON_KLFX_Click(object sender, EventArgs e)
  808. {
  809. try
  810. {
  811. if (IDC_COMBO_STDSelect.Text != "NoSTDDB")
  812. {
  813. Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", Application.StartupPath + "\\Config\\SysData\\" + IDC_COMBO_STDSelect.Text+".db");
  814. p.WaitForExit();
  815. }
  816. else
  817. {
  818. string message = table["message55"].ToString();
  819. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  820. }
  821. }
  822. catch (Exception ex)
  823. {
  824. log.Error("OTSPartA_STDEditor:" + ex.ToString());
  825. }
  826. }
  827. private void IDC_BUTTON_MEASPRAMPATHSET_Click(object sender, EventArgs e)
  828. {
  829. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  830. {
  831. IDC_EDIT_MEASUREPARAMPATH.Text = folderBrowserDialog1.SelectedPath;
  832. }
  833. else
  834. {
  835. folderBrowserDialog1.SelectedPath = IDC_EDIT_MEASUREPARAMPATH.Text;
  836. }
  837. }
  838. private void IDC_BUTTON_PARTSTDLIBPATHSET_Click(object sender, EventArgs e)
  839. {
  840. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  841. {
  842. IDC_EDIT_ANALYSESTDLIBPATH.Text = folderBrowserDialog1.SelectedPath;
  843. }
  844. else {
  845. folderBrowserDialog1.SelectedPath = IDC_EDIT_ANALYSESTDLIBPATH.Text;
  846. }
  847. }
  848. /// <summary>
  849. /// 弹出样品台管理窗体
  850. /// </summary>
  851. /// <param name="a_nPackId"></param>
  852. /// <param name="a_pStageFile"></param>
  853. /// <returns></returns>
  854. public void ShowStageDialogExport()
  855. {
  856. DlgStageMgr dlgStageMgr = new DlgStageMgr(m_cstagefile);
  857. dlgStageMgr.ShowDialog();
  858. return;
  859. }
  860. /// <summary>
  861. /// 保存样品台信息
  862. /// </summary>
  863. /// <returns></returns>
  864. public bool CStageFileClrSave()
  865. {
  866. if (m_cstagefile == null)
  867. {
  868. //报错
  869. log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample station information!");
  870. }
  871. else
  872. {
  873. bool b_ret = m_cstagefile.Save();
  874. if (false == b_ret)
  875. {
  876. log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample table information!");
  877. }
  878. }
  879. return false;
  880. }
  881. private void IDC_BUTTON_STAGE_Click(object sender, EventArgs e)
  882. {
  883. //弹出管理样品台管理窗体
  884. ShowStageDialogExport();
  885. //弹出后再保存样品台信息
  886. CStageFileClrSave();
  887. //刷新绑定样品台列表
  888. BindStageCombobox();
  889. //检测是否已经有修改
  890. ThisSetIsModify();
  891. }
  892. /// <summary>
  893. /// 判断各控件值是否正确
  894. /// </summary>
  895. /// <returns></returns>
  896. private bool CheckSetupValues(int bz)
  897. {
  898. if ("" == IDC_COMBO_STAGE.Text)
  899. {
  900. string message = table["message1"].ToString();
  901. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  902. IDC_COMBO_STAGE.Focus();
  903. IDC_COMBO_STAGE.SelectAll();
  904. return false;
  905. }
  906. if ("" == IDC_EDIT_SCREENWIDTH.Text)
  907. {
  908. string message = table["message2"].ToString();
  909. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  910. IDC_EDIT_SCREENWIDTH.Focus();
  911. IDC_EDIT_SCREENWIDTH.SelectAll();
  912. return false;
  913. }
  914. if ("" == IDC_COMBO_XDIREC.Text)
  915. {
  916. string message = table["message3"].ToString();
  917. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  918. IDC_COMBO_XDIREC.Focus();
  919. IDC_COMBO_XDIREC.SelectAll();
  920. return false;
  921. }
  922. if ("" == IDC_EDIT_XSTART.Text)
  923. {
  924. string message = table["message4"].ToString();
  925. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  926. IDC_EDIT_XSTART.Focus();
  927. IDC_EDIT_XSTART.SelectAll();
  928. return false;
  929. }
  930. if ("" == IDC_EDIT_XEND.Text)
  931. {
  932. string message = table["message4"].ToString();
  933. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  934. IDC_EDIT_XEND.Focus();
  935. IDC_EDIT_XEND.SelectAll();
  936. return false;
  937. }
  938. if ("" == IDC_COMBO_YDIRECT.Text)
  939. {
  940. string message = table["message5"].ToString();
  941. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  942. IDC_COMBO_YDIRECT.Focus();
  943. IDC_COMBO_YDIRECT.SelectAll();
  944. return false;
  945. }
  946. if ("" == IDC_EDIT_YSTART.Text)
  947. {
  948. string message = table["message6"].ToString();
  949. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  950. IDC_EDIT_YSTART.Focus();
  951. IDC_EDIT_YSTART.SelectAll();
  952. return false;
  953. }
  954. if ("" == IDC_EDIT_YEND.Text)
  955. {
  956. string message = table["message6"].ToString();
  957. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  958. IDC_EDIT_YEND.Focus();
  959. IDC_EDIT_YEND.SelectAll();
  960. return false;
  961. }
  962. if ("" == tB_StopMode.Text)
  963. {
  964. string message = table["message7"].ToString();
  965. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  966. //IDC_EDIT_STOP_TIME.Focus();
  967. //IDC_EDIT_STOP_TIME.SelectAll();
  968. return false;
  969. }
  970. if ("" == IDC_COMBO_FETCHIMGMODE.Text)
  971. {
  972. string message = table["message10"].ToString();
  973. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  974. IDC_COMBO_FETCHIMGMODE.Focus();
  975. IDC_COMBO_FETCHIMGMODE.SelectAll();
  976. return false;
  977. }
  978. if ("" == IDC_COMBO_IMGSCANSPEED.Text)
  979. {
  980. string message = table["message11"].ToString();
  981. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  982. IDC_COMBO_IMGSCANSPEED.Focus();
  983. IDC_COMBO_IMGSCANSPEED.SelectAll();
  984. return false;
  985. }
  986. if ("" == IDC_COMBO_IMGSIZE.Text)
  987. {
  988. string message = table["message12"].ToString();
  989. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  990. IDC_COMBO_IMGSIZE.Focus();
  991. IDC_COMBO_IMGSIZE.SelectAll();
  992. return false;
  993. }
  994. if ("" == IDC_EDIT_MINMAG.Text)
  995. {
  996. string message = table["message13"].ToString();
  997. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  998. IDC_EDIT_MINMAG.Focus();
  999. IDC_EDIT_MINMAG.SelectAll();
  1000. return false;
  1001. }
  1002. if ("" == IDC_EDIT_PARTAREAMIN.Text)
  1003. {
  1004. string message = table["message14"].ToString();
  1005. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1006. IDC_EDIT_PARTAREAMIN.Focus();
  1007. IDC_EDIT_PARTAREAMIN.SelectAll();
  1008. return false;
  1009. }
  1010. if ("" == IDC_EDIT_PARTAREAMAX.Text)
  1011. {
  1012. string message = table["message15"].ToString();
  1013. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1014. IDC_EDIT_PARTAREAMAX.Focus();
  1015. IDC_EDIT_PARTAREAMAX.SelectAll();
  1016. return false;
  1017. }
  1018. if ("" == IDC_EDIT_BACKMIN.Text)
  1019. {
  1020. string message = table["message16"].ToString();
  1021. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1022. IDC_EDIT_BACKMIN.Focus();
  1023. IDC_EDIT_BACKMIN.SelectAll();
  1024. return false;
  1025. }
  1026. if ("" == IDC_EDIT_BACKMAX.Text)
  1027. {
  1028. string message = table["message17"].ToString();
  1029. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1030. IDC_EDIT_BACKMAX.Focus();
  1031. IDC_EDIT_BACKMAX.SelectAll();
  1032. return false;
  1033. }
  1034. if ("" == IDC_EDIT_PARTMIN.Text)
  1035. {
  1036. string message = table["message18"].ToString();
  1037. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1038. IDC_EDIT_PARTMIN.Focus();
  1039. IDC_EDIT_PARTMIN.SelectAll();
  1040. return false;
  1041. }
  1042. if ("" == IDC_EDIT_PARTMAX.Text)
  1043. {
  1044. string message = table["message19"].ToString();
  1045. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1046. IDC_EDIT_PARTMAX.Focus();
  1047. IDC_EDIT_PARTMAX.SelectAll();
  1048. return false;
  1049. }
  1050. if ("" == IDC_COMBO_XRAYSCANMODE.Text)
  1051. {
  1052. string message = table["message20"].ToString();
  1053. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1054. IDC_COMBO_XRAYSCANMODE.Focus();
  1055. IDC_COMBO_XRAYSCANMODE.SelectAll();
  1056. return false;
  1057. }
  1058. if ("" == IDC_COMBO_ANALYXRAYSPEED.Text)
  1059. {
  1060. string message = table["message21"].ToString();
  1061. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1062. IDC_COMBO_ANALYXRAYSPEED.Focus();
  1063. IDC_COMBO_ANALYXRAYSPEED.SelectAll();
  1064. return false;
  1065. }
  1066. if ("" == IDC_EDIT_ANALYXRAYAIMVALUE.Text)
  1067. {
  1068. string message = table["message22"].ToString();
  1069. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1070. IDC_EDIT_ANALYXRAYAIMVALUE.Focus();
  1071. IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();
  1072. return false;
  1073. }
  1074. if ("" == tBMeasArea.Text)
  1075. {
  1076. string message = table["message62"].ToString();
  1077. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1078. tBMeasArea.Focus();
  1079. tBMeasArea.SelectAll();
  1080. return false;
  1081. }
  1082. //if ("" == IDC_COMBO_CorrosionExpansionCoefficient.Text)
  1083. //{
  1084. // string message = table["message62"].ToString();
  1085. // MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1086. // IDC_COMBO_CorrosionExpansionCoefficient.Focus();
  1087. // IDC_COMBO_CorrosionExpansionCoefficient.SelectAll();
  1088. // return false;
  1089. //}
  1090. //string pat = @"^(-|\+)?\d{1,8}$";//只能输入1到3位的正负整数
  1091. string pat = @"^-?[0-9]\d*$";//只能限定正负整数,包含0
  1092. string scope = @"^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$";
  1093. string PositiveDecimals = @"^(([1-9]\d*)(\.\d+)?)$|^0\.\d*[1-9]$"; //正浮点数
  1094. string positiveInteger = @"^?[0-9]\d*$";//只能限定正整数,包含0
  1095. string positiveOddNumber = @"[^1,3,5,7,9]";//只能限定正奇数
  1096. Regex rg = new Regex(pat);
  1097. Regex rgScope = new Regex(scope);
  1098. Regex rgPositiveDecimals = new Regex(PositiveDecimals);
  1099. Regex rgpositiveInteger = new Regex(positiveInteger);
  1100. Regex rgpositiveOddNumber = new Regex(positiveOddNumber);
  1101. //是否是正确的数值格式类型判断
  1102. //if(IDC_COMBO_CorrosionExpansionCoefficient.Text!="0")
  1103. //{
  1104. // if (rgpositiveOddNumber.Match(IDC_COMBO_CorrosionExpansionCoefficient.Text.Trim()).Success)
  1105. // {
  1106. // IDC_COMBO_CorrosionExpansionCoefficient.Focus();
  1107. // IDC_COMBO_CorrosionExpansionCoefficient.SelectAll();
  1108. // string message = table["message66"].ToString();
  1109. // MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1110. // return false;
  1111. // }
  1112. //}
  1113. //100倍时屏幕尺寸
  1114. if (false == rg.Match(IDC_EDIT_SCREENWIDTH.Text.Trim()).Success)
  1115. {
  1116. IDC_EDIT_SCREENWIDTH.Focus();
  1117. IDC_EDIT_SCREENWIDTH.SelectAll();
  1118. string message = table["message23"].ToString();
  1119. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1120. return false;
  1121. }
  1122. //x轴行程/mm 起
  1123. if (false == rg.Match(IDC_EDIT_XSTART.Text.Trim()).Success)
  1124. {
  1125. IDC_EDIT_XSTART.Focus();
  1126. IDC_EDIT_XSTART.SelectAll();
  1127. string message = table["message24"].ToString();
  1128. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1129. return false;
  1130. }
  1131. //x轴行程/mm 止
  1132. if (false == rg.Match(IDC_EDIT_XEND.Text.Trim()).Success)
  1133. {
  1134. IDC_EDIT_XEND.Focus();
  1135. IDC_EDIT_XEND.SelectAll();
  1136. string message = table["message25"].ToString();
  1137. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1138. return false;
  1139. }
  1140. //y轴行程/mm 起
  1141. if (false == rg.Match(IDC_EDIT_YSTART.Text.Trim()).Success)
  1142. {
  1143. IDC_EDIT_YSTART.Focus();
  1144. IDC_EDIT_YSTART.SelectAll();
  1145. string message = table["message26"].ToString();
  1146. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1147. return false;
  1148. }
  1149. //y轴行程/mm 止
  1150. if (false == rg.Match(IDC_EDIT_YEND.Text.Trim()).Success)
  1151. {
  1152. IDC_EDIT_YEND.Focus();
  1153. IDC_EDIT_YEND.SelectAll();
  1154. string message = table["message27"].ToString();
  1155. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1156. return false;
  1157. }
  1158. //颗粒面积范围 最小
  1159. if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMIN.Text.Trim()).Success)
  1160. {
  1161. IDC_EDIT_PARTAREAMIN.Focus();
  1162. IDC_EDIT_PARTAREAMIN.SelectAll();
  1163. string message = table["message31"].ToString();
  1164. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1165. return false;
  1166. }
  1167. //颗粒面积范围 最大
  1168. if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMAX.Text.Trim()).Success)
  1169. {
  1170. IDC_EDIT_PARTAREAMAX.Focus();
  1171. IDC_EDIT_PARTAREAMAX.SelectAll();
  1172. string message = table["message32"].ToString();
  1173. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1174. return false;
  1175. }
  1176. //背景灰度范围 最小
  1177. if (false == rg.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)
  1178. {
  1179. IDC_EDIT_BACKMIN.Focus();
  1180. IDC_EDIT_BACKMIN.SelectAll();
  1181. string message = table["message33"].ToString();
  1182. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1183. return false;
  1184. }
  1185. else
  1186. {
  1187. if (false == rgScope.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)
  1188. {
  1189. IDC_EDIT_BACKMIN.Focus();
  1190. IDC_EDIT_BACKMIN.SelectAll();
  1191. string message = table["message34"].ToString();
  1192. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1193. return false;
  1194. }
  1195. }
  1196. //背景灰度范围 最大
  1197. if (false == rg.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)
  1198. {
  1199. IDC_EDIT_BACKMAX.Focus();
  1200. IDC_EDIT_BACKMAX.SelectAll();
  1201. string message = table["message35"].ToString();
  1202. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1203. return false;
  1204. }
  1205. else
  1206. {
  1207. if (false == rgScope.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)
  1208. {
  1209. IDC_EDIT_BACKMAX.Focus();
  1210. IDC_EDIT_BACKMAX.SelectAll();
  1211. string message = table["message36"].ToString();
  1212. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1213. return false;
  1214. }
  1215. }
  1216. //颗粒灰度范围 最小
  1217. if (false == rg.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)
  1218. {
  1219. IDC_EDIT_PARTMIN.Focus();
  1220. IDC_EDIT_PARTMIN.SelectAll();
  1221. string message = table["message37"].ToString();
  1222. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1223. return false;
  1224. }
  1225. else
  1226. {
  1227. if (false == rgScope.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)
  1228. {
  1229. IDC_EDIT_PARTMIN.Focus();
  1230. IDC_EDIT_PARTMIN.SelectAll();
  1231. string message = table["message38"].ToString();
  1232. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1233. return false;
  1234. }
  1235. }
  1236. //颗粒灰度范围 最大
  1237. if (false == rg.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)
  1238. {
  1239. IDC_EDIT_PARTMAX.Focus();
  1240. IDC_EDIT_PARTMAX.SelectAll();
  1241. string message = table["message39"].ToString();
  1242. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1243. return false;
  1244. }
  1245. else
  1246. {
  1247. if (false == rgScope.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)
  1248. {
  1249. IDC_EDIT_PARTMAX.Focus();
  1250. IDC_EDIT_PARTMAX.SelectAll();
  1251. string message = table["message40"].ToString();
  1252. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1253. return false;
  1254. }
  1255. }
  1256. //分析X-ray计数期望值 最大
  1257. if (false == rg.Match(IDC_EDIT_ANALYXRAYAIMVALUE.Text.Trim()).Success)
  1258. {
  1259. IDC_EDIT_ANALYXRAYAIMVALUE.Focus();
  1260. IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();
  1261. string message = table["message41"].ToString();
  1262. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1263. return false;
  1264. }
  1265. //分析X-ray精度对应的时间
  1266. if (false == rg.Match(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()).Success)
  1267. {
  1268. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Focus();
  1269. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.SelectAll();
  1270. string message = table["message42"].ToString();
  1271. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1272. return false;
  1273. }
  1274. //if (false == rgPositiveDecimals.Match(IDC_EDIT_QuantifyMinSize.Text.Trim()).Success)
  1275. //{
  1276. // IDC_EDIT_QuantifyMinSize.Focus();
  1277. // IDC_EDIT_QuantifyMinSize.SelectAll();
  1278. // string message = table["message63"].ToString();
  1279. // MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1280. // return false;
  1281. //}
  1282. pat = @"^[0-9]+(\.[0-9]{1,3})?$"; //只能输入,1到3位小数的正数
  1283. rg = new Regex(pat);
  1284. //最小放大倍数
  1285. if (false == rg.Match(IDC_EDIT_MINMAG.Text.Trim()).Success)
  1286. {
  1287. IDC_EDIT_MINMAG.Focus();
  1288. IDC_EDIT_MINMAG.SelectAll();
  1289. string message = table["message43"].ToString();
  1290. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1291. return false;
  1292. }
  1293. ////最小放大倍数不得小于45倍
  1294. //if (Convert.ToInt32(IDC_EDIT_MINMAG.Text.Trim()) < 45)
  1295. //{
  1296. // IDC_EDIT_MINMAG.Focus();
  1297. // IDC_EDIT_MINMAG.SelectAll();
  1298. // string message = "The minimum magnification cannot be less than 45 times";
  1299. // MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1300. // return false;
  1301. //}
  1302. //再限制,x轴,y轴,的起止的,输入长度,因为现在已经有在mm和um之间的转换,所以这里要限制一下
  1303. //x轴行程/mm 起
  1304. if (IDC_EDIT_XSTART.Text.Length > 4)
  1305. {
  1306. IDC_EDIT_XSTART.Focus();
  1307. IDC_EDIT_XSTART.SelectAll();
  1308. string message = table["message44"].ToString();
  1309. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1310. return false;
  1311. }
  1312. //x轴行程/mm 止
  1313. if (IDC_EDIT_XEND.Text.Length > 4)
  1314. {
  1315. IDC_EDIT_XEND.Focus();
  1316. IDC_EDIT_XEND.SelectAll();
  1317. string message = table["message45"].ToString();
  1318. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1319. return false;
  1320. }
  1321. //y轴行程/mm 起
  1322. if (IDC_EDIT_YSTART.Text.Length > 4)
  1323. {
  1324. IDC_EDIT_YSTART.Focus();
  1325. IDC_EDIT_YSTART.SelectAll();
  1326. string message = table["message46"].ToString();
  1327. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1328. return false;
  1329. }
  1330. //y轴行程/mm 止
  1331. if (IDC_EDIT_YEND.Text.Length > 4)
  1332. {
  1333. IDC_EDIT_YEND.Focus();
  1334. IDC_EDIT_YEND.SelectAll();
  1335. string message = table["message47"].ToString();
  1336. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1337. return false;
  1338. }
  1339. if (Convert.ToInt32(IDC_EDIT_XSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_XEND.Text.Trim()))
  1340. {
  1341. IDC_EDIT_XEND.Focus();
  1342. IDC_EDIT_XEND.SelectAll();
  1343. string message = table["message50"].ToString();
  1344. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1345. return false;
  1346. }
  1347. if (Convert.ToInt32(IDC_EDIT_YSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_YEND.Text.Trim()))
  1348. {
  1349. IDC_EDIT_YEND.Focus();
  1350. IDC_EDIT_YEND.SelectAll();
  1351. string message = table["message53"].ToString();
  1352. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1353. return false;
  1354. }
  1355. //颗粒尺寸范围
  1356. if (Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text.Trim()) > Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text.Trim()))
  1357. {
  1358. IDC_EDIT_PARTAREAMIN.Focus();
  1359. IDC_EDIT_PARTAREAMIN.SelectAll();
  1360. string message = table["message56"].ToString();
  1361. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1362. return false;
  1363. }
  1364. //背景灰度范围
  1365. if (Convert.ToInt32(IDC_EDIT_BACKMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_BACKMAX.Text.Trim()))
  1366. {
  1367. IDC_EDIT_BACKMIN.Focus();
  1368. IDC_EDIT_BACKMIN.SelectAll();
  1369. string message = table["message57"].ToString();
  1370. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1371. return false;
  1372. }
  1373. //颗粒灰度范围
  1374. if (Convert.ToInt32(IDC_EDIT_PARTMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_PARTMAX.Text.Trim()))
  1375. {
  1376. IDC_EDIT_PARTMIN.Focus();
  1377. IDC_EDIT_PARTMIN.SelectAll();
  1378. string message = table["message58"].ToString();
  1379. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1380. return false;
  1381. }
  1382. //最小放大倍数
  1383. if (false == rgpositiveInteger.Match(IDC_EDIT_XrayLimit.Text.Trim()).Success)
  1384. {
  1385. IDC_EDIT_XrayLimit.Focus();
  1386. IDC_EDIT_XrayLimit.SelectAll();
  1387. string message = table["message64"].ToString();
  1388. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1389. return false;
  1390. }
  1391. return true;
  1392. }
  1393. /// <summary>
  1394. /// 判断当前样品台是否在被修改
  1395. /// </summary>
  1396. /// <returns></returns>
  1397. public bool IsModified()
  1398. {
  1399. return m_cstagefile.IsModified();
  1400. }
  1401. /// <summary>
  1402. /// 样品台保存
  1403. /// </summary>
  1404. /// <returns></returns>
  1405. public bool StageSave()
  1406. {
  1407. if (!m_cstagefile.Save())
  1408. {
  1409. log.Error("(OTSProgMgrInfoFun.StageLoad) Failed to save sample station information!");
  1410. return false;
  1411. }
  1412. return true;
  1413. }
  1414. private void btnok_Click(object sender, EventArgs e)
  1415. {
  1416. //先判断
  1417. if (false == CheckSetupValues(1))
  1418. {
  1419. return;
  1420. }
  1421. //先把各个值都保存到各类
  1422. m_cotsprogmgrparamfile.m_runmode = (RunMode)IDC_COMBO_Model.SelectedIndex;
  1423. SaveSEMStageData();
  1424. SaveImageScanPrm();
  1425. SaveCGenParam();
  1426. SaveImageProc();
  1427. SaveXRayParam();
  1428. //然后再把各类传入到SaveInfoToProgMgrFile函数中
  1429. if (false == SaveInfoToProgMgrFile())
  1430. {
  1431. return;
  1432. }
  1433. //保存样品台到文件,在被修改时进行保存
  1434. if (true == IsModified())
  1435. {
  1436. if (true == StageSave())
  1437. {
  1438. this.DialogResult = DialogResult.OK;
  1439. this.Close();
  1440. return;
  1441. }
  1442. else
  1443. {
  1444. string message = table["message54"].ToString();
  1445. log.Error("(ProgMgrInfoForm.btnok_Click) " + message);
  1446. this.Close();
  1447. return;
  1448. }
  1449. }
  1450. }
  1451. //关闭窗体
  1452. private void btncancel_Click(object sender, EventArgs e)
  1453. {
  1454. this.Close();
  1455. }
  1456. #endregion
  1457. #region 选择样品台事件
  1458. private void IDC_COMBO_STAGE_SelectedIndexChanged(object sender, EventArgs e)
  1459. {
  1460. //样品台
  1461. if (!StageLoad())
  1462. {
  1463. this.Close();
  1464. return;//加载失败返回
  1465. }
  1466. ThisSetIsModify();
  1467. //加载相关参数信息
  1468. //StageLoad();
  1469. //LoadSEMStageData();
  1470. //LoadImageScanPrm();
  1471. //LoadCGenParam();
  1472. //LoadImageProc();
  1473. //LoadXRayParam();
  1474. }
  1475. /// <summary>
  1476. /// 通过id设置当前正在工作的样品台
  1477. /// </summary>
  1478. /// <param name="id"></param>
  1479. public void SetWorkingStageId(int id)
  1480. {
  1481. m_cstagefile.SetWorkingStageId(id);
  1482. }
  1483. /// <summary>
  1484. /// 设置当前样品台正在被修改中
  1485. /// </summary>
  1486. /// <param name="yn"></param>
  1487. public void SetModify(bool yn)
  1488. {
  1489. m_cstagefile.SetModify(true);
  1490. }
  1491. /// <summary>
  1492. /// 设置当前窗体可以保存了
  1493. /// </summary>
  1494. private void ThisSetIsModify()
  1495. {
  1496. ComboBoxItem cbi = new ComboBoxItem();
  1497. if (IDC_COMBO_STAGE.Items.Count > 0)
  1498. if (null != IDC_COMBO_STAGE.SelectedItem)
  1499. {
  1500. cbi = (ComboBoxItem)IDC_COMBO_STAGE.SelectedItem;
  1501. SetWorkingStageId(Convert.ToInt32(cbi.Value));
  1502. SetModify(true);
  1503. btnok.Enabled = true;
  1504. }
  1505. }
  1506. #endregion
  1507. #region 监视控件改变状态事件
  1508. private void IDC_EDIT_SCREENWIDTH_TextChanged(object sender, EventArgs e)
  1509. {
  1510. ThisSetIsModify();
  1511. }
  1512. private void IDC_COMBO_XDIREC_SelectedIndexChanged(object sender, EventArgs e)
  1513. {
  1514. ThisSetIsModify();
  1515. }
  1516. private void IDC_EDIT_XSTART_TextChanged(object sender, EventArgs e)
  1517. {
  1518. ThisSetIsModify();
  1519. }
  1520. private void IDC_EDIT_XEND_TextChanged(object sender, EventArgs e)
  1521. {
  1522. ThisSetIsModify();
  1523. }
  1524. private void IDC_COMBO_YDIRECT_SelectedIndexChanged(object sender, EventArgs e)
  1525. {
  1526. ThisSetIsModify();
  1527. }
  1528. private void IDC_EDIT_YSTART_TextChanged(object sender, EventArgs e)
  1529. {
  1530. ThisSetIsModify();
  1531. }
  1532. private void IDC_EDIT_YEND_TextChanged(object sender, EventArgs e)
  1533. {
  1534. ThisSetIsModify();
  1535. }
  1536. private void IDC_EDIT_MINMAG_TextChanged(object sender, EventArgs e)
  1537. {
  1538. ThisSetIsModify();
  1539. }
  1540. private void IDC_COMBO_STOPMODE_SelectedIndexChanged(object sender, EventArgs e)
  1541. {
  1542. ThisSetIsModify();
  1543. }
  1544. private void IDC_EDIT_STOP_TIME_TextChanged(object sender, EventArgs e)
  1545. {
  1546. ThisSetIsModify();
  1547. }
  1548. private void IDC_EDIT_STOP_FIELD_NUM_TextChanged(object sender, EventArgs e)
  1549. {
  1550. ThisSetIsModify();
  1551. }
  1552. private void IDC_EDIT_STOP_INCA_NUM_TextChanged(object sender, EventArgs e)
  1553. {
  1554. ThisSetIsModify();
  1555. }
  1556. private void IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged(object sender, EventArgs e)
  1557. {
  1558. ThisSetIsModify();
  1559. }
  1560. private void IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1561. {
  1562. ThisSetIsModify();
  1563. }
  1564. private void IDC_COMBO_IMGSIZE_SelectedIndexChanged(object sender, EventArgs e)
  1565. {
  1566. ThisSetIsModify();
  1567. }
  1568. private void IDC_EDIT_SAMPLENAME_TextChanged(object sender, EventArgs e)
  1569. {
  1570. ThisSetIsModify();
  1571. }
  1572. private void IDC_MEAS_SWITCH_CheckedChanged(object sender, EventArgs e)
  1573. {
  1574. ThisSetIsModify();
  1575. }
  1576. private void IDC_EDIT_MEASUREPARAMPATH_TextChanged(object sender, EventArgs e)
  1577. {
  1578. ThisSetIsModify();
  1579. }
  1580. private void IDC_EDIT_ANALYSESTDLIBPATH_TextChanged(object sender, EventArgs e)
  1581. {
  1582. ThisSetIsModify();
  1583. }
  1584. private void IDC_EDIT_STDLIBNAME_TextChanged(object sender, EventArgs e)
  1585. {
  1586. ThisSetIsModify();
  1587. }
  1588. private void IDC_EDIT_PARTAREAMIN_TextChanged(object sender, EventArgs e)
  1589. {
  1590. ThisSetIsModify();
  1591. }
  1592. private void IDC_EDIT_PARTAREAMAX_TextChanged(object sender, EventArgs e)
  1593. {
  1594. ThisSetIsModify();
  1595. }
  1596. private void IDC_EDIT_BACKMIN_TextChanged(object sender, EventArgs e)
  1597. {
  1598. ThisSetIsModify();
  1599. }
  1600. private void IDC_EDIT_BACKMAX_TextChanged(object sender, EventArgs e)
  1601. {
  1602. ThisSetIsModify();
  1603. }
  1604. private void IDC_EDIT_PARTMIN_TextChanged(object sender, EventArgs e)
  1605. {
  1606. ThisSetIsModify();
  1607. }
  1608. private void IDC_EDIT_PARTMAX_TextChanged(object sender, EventArgs e)
  1609. {
  1610. ThisSetIsModify();
  1611. }
  1612. private void IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)
  1613. {
  1614. ThisSetIsModify();
  1615. }
  1616. private void IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)
  1617. {
  1618. ComboBox cbBGREMOVETYPE = (ComboBox)sender;
  1619. int selectValue=Convert.ToInt32(((OTSMeasureApp.ComboBoxItem)cbBGREMOVETYPE.Items[cbBGREMOVETYPE.SelectedIndex]).Value);
  1620. if (selectValue == (int)otsdataconst.OTS_AUTOBGREMOVETYPE.MANUAL)
  1621. {
  1622. IDC_COMBO_AUTOBGREMOVETYP.Enabled = false;
  1623. }
  1624. else
  1625. {
  1626. IDC_COMBO_AUTOBGREMOVETYP.Enabled = true;
  1627. }
  1628. ThisSetIsModify();
  1629. }
  1630. private void IDC_COMBO_SEARCHXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1631. {
  1632. ThisSetIsModify();
  1633. }
  1634. private void IDC_EDIT_SEARCHXRAYCOUNTLIMIT_TextChanged(object sender, EventArgs e)
  1635. {
  1636. ThisSetIsModify();
  1637. }
  1638. private void IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged(object sender, EventArgs e)
  1639. {
  1640. ThisSetIsModify();
  1641. }
  1642. private void IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1643. {
  1644. ThisSetIsModify();
  1645. }
  1646. private void IDC_EDIT_ANALYXRAYAIMVALUE_TextChanged(object sender, EventArgs e)
  1647. {
  1648. ThisSetIsModify();
  1649. }
  1650. private void IDC_COMBO_TECHNOLOGY_SelectedIndexChanged(object sender, EventArgs e)
  1651. {
  1652. ThisSetIsModify();
  1653. }
  1654. private void IDC_STOP_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1655. {
  1656. ThisSetIsModify();
  1657. }
  1658. private void IDC_STOP_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)
  1659. {
  1660. ThisSetIsModify();
  1661. }
  1662. private void IDC_STOP_FIELD_SWITCH_CheckedChanged(object sender, EventArgs e)
  1663. {
  1664. ThisSetIsModify();
  1665. }
  1666. private void IDC_STOP_PARTICAL_SWITCH_CheckedChanged(object sender, EventArgs e)
  1667. {
  1668. ThisSetIsModify();
  1669. }
  1670. private void IDC_FETCH_IMAGE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1671. {
  1672. ThisSetIsModify();
  1673. }
  1674. private void IDC_SCAN_SPEED_SWITCH_CheckedChanged(object sender, EventArgs e)
  1675. {
  1676. ThisSetIsModify();
  1677. }
  1678. private void IDC_IMAGE_SIZE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1679. {
  1680. ThisSetIsModify();
  1681. }
  1682. private void IDC_PART_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)
  1683. {
  1684. ThisSetIsModify();
  1685. }
  1686. private void IDC_PART_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)
  1687. {
  1688. ThisSetIsModify();
  1689. }
  1690. private void IDC_BACK_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)
  1691. {
  1692. ThisSetIsModify();
  1693. }
  1694. private void IDC_BACK_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)
  1695. {
  1696. ThisSetIsModify();
  1697. }
  1698. private void IDC_PART_GRAY_SWITCH_CheckedChanged(object sender, EventArgs e)
  1699. {
  1700. ThisSetIsModify();
  1701. }
  1702. private void IDC_PART_GRAY_MAX_CheckedChanged(object sender, EventArgs e)
  1703. {
  1704. ThisSetIsModify();
  1705. }
  1706. private void IDC_XRAY_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1707. {
  1708. ThisSetIsModify();
  1709. }
  1710. private void IDC_XRAY_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)
  1711. {
  1712. ThisSetIsModify();
  1713. }
  1714. private void IDC_XRAY_COUNT_SWITCH_CheckedChanged(object sender, EventArgs e)
  1715. {
  1716. ThisSetIsModify();
  1717. }
  1718. private void cBMeasShape_SelectedIndexChanged(object sender, EventArgs e)
  1719. {
  1720. ThisSetIsModify();
  1721. }
  1722. private void tBMeasArea_TextChanged(object sender, EventArgs e)
  1723. {
  1724. ThisSetIsModify();
  1725. }
  1726. private void IDC_SYS_LIB_CheckedChanged(object sender, EventArgs e)
  1727. {
  1728. ThisSetIsModify();
  1729. }
  1730. #endregion
  1731. private void IDC_COMBO_STDSelect_SelectedIndexChanged(object sender, EventArgs e)
  1732. {
  1733. ThisSetIsModify();
  1734. }
  1735. private void IDC_COMBO_USINGXRAYS_SelectedIndexChanged(object sender, EventArgs e)
  1736. {
  1737. ThisSetIsModify();
  1738. }
  1739. private void IDC_COMBO_Model_SelectedIndexChanged(object sender, EventArgs e)
  1740. {
  1741. ThisSetIsModify();
  1742. }
  1743. private void btn_StopMode_Click(object sender, EventArgs e)
  1744. {
  1745. if (StopModeDialog == null)
  1746. {
  1747. StopModeDialog = new frmMeasureStopMode();
  1748. StopModeDialog.FieldMode = m_cotsimgscanprm.GetStopParamFields();
  1749. StopModeDialog.TimeMode = m_cotsimgscanprm.GetStopParamMeasTime();
  1750. StopModeDialog.ParticleMode = m_cotsimgscanprm.GetStopParamParticles();
  1751. StopModeDialog.AreaMode = m_cotsimgscanprm.GetStopParamArea();
  1752. StopModeDialog.StopMode = tB_StopMode.Text;
  1753. }
  1754. DialogResult result = StopModeDialog.ShowDialog();
  1755. if (result == DialogResult.OK)
  1756. {
  1757. string[] rst = StopModeDialog.StopMode.Split(',');
  1758. string str = "";
  1759. for (int k = 0; k < rst.Length; k++)
  1760. {
  1761. str += rst[k].Split(':')[0] + " + ";
  1762. }
  1763. tB_StopMode.Text = str.Substring(0, str.Length - 3);
  1764. }
  1765. }
  1766. private void IDC_COMBO_CorrosionExpansionCoefficient_TextChanged(object sender, EventArgs e)
  1767. {
  1768. ThisSetIsModify();
  1769. }
  1770. private void button_SpPart_Click(object sender, EventArgs e)
  1771. {
  1772. }
  1773. private void checkBox_Run_CheckedChanged(object sender, EventArgs e)
  1774. {
  1775. }
  1776. }
  1777. public class ComboBoxItem
  1778. {
  1779. private string _text = null;
  1780. private object _value = null;
  1781. public string Text { get { return this._text; } set { this._text = value; } }
  1782. public object Value { get { return this._value; } set { this._value = value; } }
  1783. public override string ToString()
  1784. {
  1785. return this._text;
  1786. }
  1787. }
  1788. }