ProgMgrInfoForm.cs 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042
  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.GetSteelTechnology())
  445. {
  446. IDC_COMBO_TECHNOLOGY.SelectedItem = cbi;
  447. }
  448. }
  449. //测量区域形状
  450. foreach (ComboBoxItem cbi in cBMeasShape.Items)
  451. {
  452. if (cbi.Value.ToString() != "")
  453. if (Convert.ToInt32(cbi.Value) == (int)m_cgenparam.GetShape())
  454. {
  455. cBMeasShape.SelectedItem = cbi;
  456. }
  457. }
  458. //测量区域面积
  459. tBMeasArea.Text = m_cgenparam.GetArea().ToString();
  460. //标准库选择
  461. foreach (ComboBoxItem cbi in IDC_COMBO_STDSelect.Items)
  462. {
  463. if (cbi.Text.ToString() != "")
  464. if (cbi.Text.ToString() == m_cgenparam.GetSTDSelect())
  465. {
  466. IDC_COMBO_STDSelect.SelectedItem = cbi;
  467. }
  468. }
  469. }
  470. /// <summary>
  471. /// 加载默认参数
  472. /// </summary>
  473. public void LoadDefaultParam()
  474. {
  475. //模式
  476. foreach (OTSPeriodicTable.ComboBoxItem cbi in IDC_COMBO_Model.Items)
  477. {
  478. if (cbi.Value.ToString() != "")
  479. if (Convert.ToInt32(cbi.Value) == (int)m_cotsprogmgrparamfile.GetRunMode())
  480. {
  481. IDC_COMBO_Model.SelectedItem = cbi;
  482. }
  483. }
  484. }
  485. /// <summary>
  486. /// 加载图像处理参数
  487. /// </summary>
  488. public void LoadImageProc()
  489. {
  490. //颗粒面积范围 最小
  491. IDC_EDIT_PARTAREAMIN.Text = m_cotsimgprocprm.GetIncAreaRange().GetStart().ToString();
  492. //颗粒面积范围 最大
  493. IDC_EDIT_PARTAREAMAX.Text = m_cotsimgprocprm.GetIncAreaRange().GetEnd().ToString();
  494. //背景灰度范围 最小
  495. IDC_EDIT_BACKMIN.Text = m_cotsimgprocprm.GetBGGray().GetStart().ToString();
  496. //背景灰度范围 最大
  497. IDC_EDIT_BACKMAX.Text = m_cotsimgprocprm.GetBGGray().GetEnd().ToString();
  498. //颗粒灰度范围 最小
  499. IDC_EDIT_PARTMIN.Text = m_cotsimgprocprm.GetParticleGray().GetStart().ToString();
  500. //颗粒灰度范围 最大
  501. IDC_EDIT_PARTMAX.Text = m_cotsimgprocprm.GetParticleGray().GetEnd().ToString();
  502. //腐蚀膨胀系数
  503. //IDC_COMBO_CorrosionExpansionCoefficient.Text = m_cotsimgprocprm.GetErrodDilateParam().ToString();
  504. //重叠尺寸
  505. IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();
  506. //去背景方式
  507. foreach (ComboBoxItem cbi in IDC_COMBO_BGREMOVETYPE.Items)
  508. {
  509. if (cbi.Value.ToString() != "")
  510. {
  511. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetBGRemoveType())
  512. {
  513. IDC_COMBO_BGREMOVETYPE.SelectedItem = cbi;
  514. break;
  515. }
  516. }
  517. }
  518. foreach (ComboBoxItem cbi in IDC_COMBO_AUTOBGREMOVETYP.Items)
  519. {
  520. if (cbi.Value.ToString() != "")
  521. {
  522. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetAutoBGRemoveType())
  523. {
  524. IDC_COMBO_AUTOBGREMOVETYP.SelectedItem = cbi;
  525. break;
  526. }
  527. }
  528. }
  529. //重叠尺寸
  530. IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();
  531. }
  532. /// <summary>
  533. /// 加载X-Ray参数
  534. /// </summary>
  535. public void LoadXRayParam()
  536. {
  537. //搜索X-ray精度对应的时间
  538. //IDC_TEXTBOX_SEARCHXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidSearchAQTime().ToString();
  539. foreach (ComboBoxItem cbi in IDC_COMBO_XRAYSCANMODE.Items)
  540. {
  541. if (cbi.Value.ToString() != "")
  542. if (Convert.ToInt32(cbi.Value) == (int)m_cotsxrayprm.GetScanMode())
  543. {
  544. IDC_COMBO_XRAYSCANMODE.SelectedItem = cbi;
  545. }
  546. }
  547. //是否使用电镜
  548. IDC_USINGXRAY_LIB.Checked = m_cotsxrayprm.GetUsingXray();
  549. //分析X-ray精度对应的时间
  550. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidAnalyAQTime().ToString();
  551. //分析X-ray计数期望值
  552. IDC_EDIT_ANALYXRAYAIMVALUE.Text = m_cotsxrayprm.GetAnalyExpCount().ToString();
  553. IDC_EDIT_QuantifyMinSize.Text = m_cotsxrayprm.GetFeatureModeMinSize().ToString();
  554. IDC_EDIT_SmallPartAQTime.Text = m_cotsxrayprm.GetSmallPartXrayTime().ToString();
  555. IDC_EDIT_XrayLimit.Text = m_cotsxrayprm.GetXrayLimit().ToString();
  556. IDC_FILTER.Checked = m_cotsxrayprm.GetUseFilter();
  557. }
  558. /// <summary>
  559. /// 保存SEM样品台参数
  560. /// </summary>
  561. public void SaveSEMStageData()
  562. {
  563. //100倍时屏幕尺寸/mm
  564. m_csemstagedata.SetScanFieldSize100(Convert.ToInt32(IDC_EDIT_SCREENWIDTH.Text));
  565. //x轴方向
  566. ComboBoxItem cbi_x = (ComboBoxItem)IDC_COMBO_XDIREC.SelectedItem;
  567. m_csemstagedata.SetXAxisDir((otsdataconst.OTS_X_AXIS_DIRECTION)Convert.ToInt32(cbi_x.Value));
  568. //x轴行程/mm 起,始
  569. CIntRange crc_x = new CIntRange(Convert.ToInt32(IDC_EDIT_XSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_XEND.Text) * 1000);
  570. m_csemstagedata.SetXAxis(crc_x);
  571. //y轴方向
  572. ComboBoxItem cbi_y = (ComboBoxItem)IDC_COMBO_YDIRECT.SelectedItem;
  573. m_csemstagedata.SetYAxisDir((otsdataconst.OTS_Y_AXIS_DIRECTION)Convert.ToInt32(cbi_y.Value));
  574. //y轴行程/mm 起,始
  575. CIntRange crc_y = new CIntRange(Convert.ToInt32(IDC_EDIT_YSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_YEND.Text) * 1000);
  576. m_csemstagedata.SetYAxis(crc_y);
  577. //最小放大倍数
  578. m_csemstagedata.SetMinMag(Convert.ToDouble(IDC_EDIT_MINMAG.Text));
  579. }
  580. /// <summary>
  581. /// 保存图像扫描参数
  582. /// </summary>
  583. public void SaveImageScanPrm()
  584. {
  585. // 保存图像扫描参数");
  586. //测量终止方式
  587. m_cotsimgscanprm.SetStopMode(tB_StopMode.Text);
  588. //终止时间
  589. m_cotsimgscanprm.SetStopParamMeasTime(StopModeDialog.TimeMode);
  590. ////终止帧图数
  591. m_cotsimgscanprm.SetStopParamFields(StopModeDialog.FieldMode);
  592. ////终止夹杂物数
  593. m_cotsimgscanprm.SetStopParamParticles(StopModeDialog.ParticleMode);
  594. ////终止面积
  595. m_cotsimgscanprm.SetStopParamArea(StopModeDialog.AreaMode);
  596. //取图方式
  597. ComboBoxItem enum_fetchimgmode = (ComboBoxItem)IDC_COMBO_FETCHIMGMODE.SelectedItem;
  598. m_cotsimgscanprm.SetStartImageMode((otsdataconst.OTS_GET_IMAGE_MODE)Convert.ToInt32(enum_fetchimgmode.Value));
  599. //扫描图精度
  600. ComboBoxItem enum_imgscanspeed = (ComboBoxItem)IDC_COMBO_IMGSCANSPEED.SelectedItem;
  601. m_cotsimgscanprm.SetScanImageSpeed((otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)Convert.ToInt32(enum_imgscanspeed.Value));
  602. //扫描图尺寸
  603. ComboBoxItem enum_imgsize = (ComboBoxItem)IDC_COMBO_IMGSIZE.SelectedItem;
  604. m_cotsimgscanprm.SetImageResulotion((otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)Convert.ToInt32(enum_imgsize.Value));
  605. }
  606. /// <summary>
  607. /// 保存一般常规参数
  608. /// </summary>
  609. public void SaveCGenParam()
  610. {
  611. //样品名
  612. m_cgenparam.SetSampleName(IDC_EDIT_SAMPLENAME.Text);
  613. //执行开关
  614. m_cgenparam.SetMeasurementSwitch(IDC_MEAS_SWITCH.Checked);
  615. //是否使用系统库
  616. m_cgenparam.SetSysSTD(IDC_SYS_LIB.Checked);
  617. //测量参数文件夹
  618. m_cgenparam.SetMsrParamFileFolderName(IDC_EDIT_MEASUREPARAMPATH.Text);
  619. //颗粒分析标准库文件夹
  620. m_cgenparam.SetPartSTDLibFolderName(IDC_EDIT_ANALYSESTDLIBPATH.Text);
  621. //获取精炼工艺索引
  622. ComboBoxItem cbiTECH = new ComboBoxItem();
  623. cbiTECH = (ComboBoxItem)IDC_COMBO_TECHNOLOGY.SelectedItem;
  624. //设置参数文件类中精炼工艺索引值
  625. m_cgenparam.SetSteelTechnology((int)cbiTECH.Value);
  626. //测量区域形状
  627. ComboBoxItem enum_Shape = (ComboBoxItem)cBMeasShape.SelectedItem;
  628. m_cgenparam.SetShape((otsdataconst.DOMAIN_SHAPE)Convert.ToInt32(enum_Shape.Value));
  629. //测量区域大小
  630. m_cgenparam.SetArea(Convert.ToDouble(tBMeasArea.Text));
  631. //标准库选择
  632. ComboBoxItem enum_STDLIBSELECT = (ComboBoxItem)IDC_COMBO_STDSelect.SelectedItem;
  633. m_cgenparam.SetSTDSelect(enum_STDLIBSELECT.Text.ToString());
  634. }
  635. /// <summary>
  636. /// 保存图像处理参数
  637. /// </summary>
  638. public void SaveImageProc()
  639. {
  640. //颗粒面积范围 最小 最大
  641. CDoubleRange crc_partareamin = new CDoubleRange(Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text), 2), Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text), 2));
  642. m_cotsimgprocprm.SetIncAreaRange(crc_partareamin);
  643. //背景灰度范围 最小 最大
  644. CIntRange crc_backmin = new CIntRange(Convert.ToInt32(IDC_EDIT_BACKMIN.Text), Convert.ToInt32(IDC_EDIT_BACKMAX.Text));
  645. m_cotsimgprocprm.SetBGGray(crc_backmin);
  646. //颗粒灰度范围 最小 最大
  647. CIntRange crc_partmin = new CIntRange(Convert.ToInt32(IDC_EDIT_PARTMIN.Text), Convert.ToInt32(IDC_EDIT_PARTMAX.Text));
  648. m_cotsimgprocprm.SetParticleGray(crc_partmin);
  649. //去背景方式
  650. ComboBoxItem enum_BGREMOVETYPE = (ComboBoxItem)IDC_COMBO_BGREMOVETYPE.SelectedItem;
  651. m_cotsimgprocprm.SetBGRemoveType((otsdataconst.OTS_BGREMOVE_TYPE)enum_BGREMOVETYPE.Value);
  652. //去背景方式
  653. ComboBoxItem enum_AUTOBGREMOVETYP = (ComboBoxItem)IDC_COMBO_AUTOBGREMOVETYP.SelectedItem;
  654. m_cotsimgprocprm.SetAutoBGRemoveType((otsdataconst.OTS_AUTOBGREMOVE_TYPE)enum_AUTOBGREMOVETYP.Value);
  655. //腐蚀膨胀系数
  656. //m_cotsimgprocprm.SetErrodDilateParam(Convert.ToInt32(IDC_COMBO_CorrosionExpansionCoefficient.Text));
  657. //重叠像素
  658. m_cotsimgprocprm.SetOverlapParam(Convert.ToInt32(IDC_EDIT_Overlap.Text));
  659. }
  660. /// <summary>
  661. /// 保存X-Ray参数
  662. /// </summary>
  663. public void SaveXRayParam()
  664. {
  665. //X-ray扫描方式
  666. ComboBoxItem enum_xrayscanmode = (ComboBoxItem)IDC_COMBO_XRAYSCANMODE.SelectedItem;
  667. m_cotsxrayprm.SetScanMode((otsdataconst.OTS_X_RAY_SCAN_MODE)Convert.ToInt32(enum_xrayscanmode.Value));
  668. //是否使用X-ray
  669. m_cotsxrayprm.SetUsingXray(IDC_USINGXRAY_LIB.Checked);
  670. //分析X-ray精度对应的时间
  671. m_cotsxrayprm.SetMidAnalyAQTime(Convert.ToInt32(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()));
  672. //分析X-ray计数期望值
  673. m_cotsxrayprm.SetAnalyExpCount(Convert.ToInt32(IDC_EDIT_ANALYXRAYAIMVALUE.Text));
  674. m_cotsxrayprm.SetFeatureModeMinSize(Convert.ToDouble(IDC_EDIT_QuantifyMinSize.Text));
  675. m_cotsxrayprm.SetSmallPartXrayTime(Convert.ToInt32(IDC_EDIT_SmallPartAQTime.Text));
  676. m_cotsxrayprm.SetXrayLimit(Convert.ToInt32(IDC_EDIT_XrayLimit.Text));
  677. m_cotsxrayprm.SetUseFilter(IDC_FILTER.Checked);
  678. }
  679. /// <summary>
  680. /// 将参数保存到文件
  681. /// </summary>
  682. /// <param name="a_nPackId"></param>
  683. /// <param name="a_pStageData"></param>
  684. /// <param name="a_pGenParam"></param>
  685. /// <param name="a_pImageScanParam"></param>
  686. /// <param name="a_pImageProcParam"></param>
  687. /// <param name="a_pXRayParam"></param>
  688. /// <returns></returns>
  689. public bool SaveInfoToProgMgrFile()
  690. {
  691. //SaveInfoToProgMgrFile()
  692. if (false == m_cotsprogmgrparamfile.SaveInfoToProgMgrFile())
  693. {
  694. log.Error("(OTSProgMgrInfoFun.SaveInfoToProgMgrFile) Failed to save parameters to file");
  695. return false;
  696. }
  697. return true;
  698. }
  699. /// <summary>
  700. /// 加载参数各个类
  701. /// </summary>
  702. public bool LoadParamFun()
  703. {
  704. bool result = m_cotsprogmgrparamfile.LoadInfoFromProgMgrFile();
  705. if (!result)
  706. {
  707. log.Error("(OTSProgMgrInfoFun.LoadParamFun) LoadInfoFromProgMgrFile Failed");
  708. return false;
  709. }
  710. m_csemstagedata = m_cotsprogmgrparamfile.GetStageDataParam();
  711. if (null == m_csemstagedata)
  712. {
  713. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetStageData Failed");
  714. return false;
  715. }
  716. m_cotsimgscanprm = m_cotsprogmgrparamfile.GetImageScanParam();
  717. if (null == m_cotsimgscanprm)
  718. {
  719. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetImageScanParam Failed");
  720. return false;
  721. }
  722. m_cgenparam = m_cotsprogmgrparamfile.GetGenParam();
  723. if (null == m_cgenparam)
  724. {
  725. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetGenParam Failed");
  726. return false;
  727. }
  728. m_cotsimgprocprm = m_cotsprogmgrparamfile.GetImageProcParam();
  729. if (null == m_cotsimgprocprm)
  730. {
  731. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetImageProcParam Failed");
  732. return false;
  733. }
  734. m_cotsxrayprm = m_cotsprogmgrparamfile.GetXRayParam();
  735. if (null == m_cotsxrayprm)
  736. {
  737. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetXRayParam Failed");
  738. return false;
  739. }
  740. return true;
  741. }
  742. #endregion
  743. #region 窗体加载
  744. private void ProgMgrInfoForm_Load(object sender, EventArgs e)
  745. {
  746. //加载各参数类
  747. LoadParamFun();
  748. //初始化combobox下拉框列表
  749. BindComboBox();
  750. //加载相关参数信息
  751. LoadDefaultParam();
  752. LoadSEMStageData();
  753. LoadImageScanPrm();
  754. LoadCGenParam();
  755. LoadImageProc();
  756. LoadXRayParam();
  757. if (m_b_checkstagefile == false)
  758. btnok.Enabled = true;
  759. else
  760. btnok.Enabled = false;
  761. //获取特殊颗粒信息
  762. //DataTable dt = XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0];
  763. //if (dt.Rows.Count != 0)
  764. //{
  765. // if (XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0].Rows[0]["ToRun"].ToString() == "true")
  766. // {
  767. // checkBox_Run.Checked = true;
  768. // }
  769. // else
  770. // {
  771. // checkBox_Run.Checked = false;
  772. // }
  773. //}
  774. //关于路径定位问题
  775. this.folderBrowserDialog1.SelectedPath = IDC_EDIT_MEASUREPARAMPATH.Text;
  776. string strb = ".\\Config\\SysData\\";
  777. string strc = ".\\Config\\ProData\\";
  778. string m_STDPath = strb;
  779. m_ParameterPath = strc;
  780. this.folderBrowserDialog1.SelectedPath = m_ParameterPath;
  781. IDC_EDIT_MEASUREPARAMPATH.Text = m_ParameterPath;
  782. IDC_EDIT_ANALYSESTDLIBPATH.Text = m_STDPath;
  783. if(m_cotsprogmgrparamfile.GetSysTypeName() == "IncA")
  784. {
  785. label42.Visible = true;
  786. IDC_COMBO_TECHNOLOGY.Visible = true;
  787. }
  788. else
  789. {
  790. label42.Visible = false;
  791. IDC_COMBO_TECHNOLOGY.Visible = false;
  792. }
  793. }
  794. #endregion
  795. #region 各按钮控件点击事件
  796. private void IDC_BUTTON_KLFX_Click(object sender, EventArgs e)
  797. {
  798. try
  799. {
  800. if (IDC_COMBO_STDSelect.Text != "NoSTDDB")
  801. {
  802. Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", Application.StartupPath + "\\Config\\SysData\\" + IDC_COMBO_STDSelect.Text+".db");
  803. p.WaitForExit();
  804. }
  805. else
  806. {
  807. string message = table["message55"].ToString();
  808. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  809. }
  810. }
  811. catch (Exception ex)
  812. {
  813. log.Error("OTSPartA_STDEditor:" + ex.ToString());
  814. }
  815. }
  816. private void IDC_BUTTON_MEASPRAMPATHSET_Click(object sender, EventArgs e)
  817. {
  818. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  819. {
  820. IDC_EDIT_MEASUREPARAMPATH.Text = folderBrowserDialog1.SelectedPath;
  821. }
  822. else
  823. {
  824. folderBrowserDialog1.SelectedPath = IDC_EDIT_MEASUREPARAMPATH.Text;
  825. }
  826. }
  827. private void IDC_BUTTON_PARTSTDLIBPATHSET_Click(object sender, EventArgs e)
  828. {
  829. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  830. {
  831. IDC_EDIT_ANALYSESTDLIBPATH.Text = folderBrowserDialog1.SelectedPath;
  832. }
  833. else {
  834. folderBrowserDialog1.SelectedPath = IDC_EDIT_ANALYSESTDLIBPATH.Text;
  835. }
  836. }
  837. /// <summary>
  838. /// 弹出样品台管理窗体
  839. /// </summary>
  840. /// <param name="a_nPackId"></param>
  841. /// <param name="a_pStageFile"></param>
  842. /// <returns></returns>
  843. public void ShowStageDialogExport()
  844. {
  845. DlgStageMgr dlgStageMgr = new DlgStageMgr(m_cstagefile);
  846. dlgStageMgr.ShowDialog();
  847. return;
  848. }
  849. /// <summary>
  850. /// 保存样品台信息
  851. /// </summary>
  852. /// <returns></returns>
  853. public bool CStageFileClrSave()
  854. {
  855. if (m_cstagefile == null)
  856. {
  857. //报错
  858. log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample station information!");
  859. }
  860. else
  861. {
  862. bool b_ret = m_cstagefile.Save();
  863. if (false == b_ret)
  864. {
  865. log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample table information!");
  866. }
  867. }
  868. return false;
  869. }
  870. private void IDC_BUTTON_STAGE_Click(object sender, EventArgs e)
  871. {
  872. //弹出管理样品台管理窗体
  873. ShowStageDialogExport();
  874. //弹出后再保存样品台信息
  875. CStageFileClrSave();
  876. //刷新绑定样品台列表
  877. BindStageCombobox();
  878. //检测是否已经有修改
  879. ThisSetIsModify();
  880. }
  881. /// <summary>
  882. /// 判断各控件值是否正确
  883. /// </summary>
  884. /// <returns></returns>
  885. private bool CheckSetupValues(int bz)
  886. {
  887. if ("" == IDC_COMBO_STAGE.Text)
  888. {
  889. string message = table["message1"].ToString();
  890. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  891. IDC_COMBO_STAGE.Focus();
  892. IDC_COMBO_STAGE.SelectAll();
  893. return false;
  894. }
  895. if ("" == IDC_EDIT_SCREENWIDTH.Text)
  896. {
  897. string message = table["message2"].ToString();
  898. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  899. IDC_EDIT_SCREENWIDTH.Focus();
  900. IDC_EDIT_SCREENWIDTH.SelectAll();
  901. return false;
  902. }
  903. if ("" == IDC_COMBO_XDIREC.Text)
  904. {
  905. string message = table["message3"].ToString();
  906. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  907. IDC_COMBO_XDIREC.Focus();
  908. IDC_COMBO_XDIREC.SelectAll();
  909. return false;
  910. }
  911. if ("" == IDC_EDIT_XSTART.Text)
  912. {
  913. string message = table["message4"].ToString();
  914. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  915. IDC_EDIT_XSTART.Focus();
  916. IDC_EDIT_XSTART.SelectAll();
  917. return false;
  918. }
  919. if ("" == IDC_EDIT_XEND.Text)
  920. {
  921. string message = table["message4"].ToString();
  922. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  923. IDC_EDIT_XEND.Focus();
  924. IDC_EDIT_XEND.SelectAll();
  925. return false;
  926. }
  927. if ("" == IDC_COMBO_YDIRECT.Text)
  928. {
  929. string message = table["message5"].ToString();
  930. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  931. IDC_COMBO_YDIRECT.Focus();
  932. IDC_COMBO_YDIRECT.SelectAll();
  933. return false;
  934. }
  935. if ("" == IDC_EDIT_YSTART.Text)
  936. {
  937. string message = table["message6"].ToString();
  938. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  939. IDC_EDIT_YSTART.Focus();
  940. IDC_EDIT_YSTART.SelectAll();
  941. return false;
  942. }
  943. if ("" == IDC_EDIT_YEND.Text)
  944. {
  945. string message = table["message6"].ToString();
  946. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  947. IDC_EDIT_YEND.Focus();
  948. IDC_EDIT_YEND.SelectAll();
  949. return false;
  950. }
  951. if ("" == tB_StopMode.Text)
  952. {
  953. string message = table["message7"].ToString();
  954. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  955. //IDC_EDIT_STOP_TIME.Focus();
  956. //IDC_EDIT_STOP_TIME.SelectAll();
  957. return false;
  958. }
  959. if ("" == IDC_COMBO_FETCHIMGMODE.Text)
  960. {
  961. string message = table["message10"].ToString();
  962. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  963. IDC_COMBO_FETCHIMGMODE.Focus();
  964. IDC_COMBO_FETCHIMGMODE.SelectAll();
  965. return false;
  966. }
  967. if ("" == IDC_COMBO_IMGSCANSPEED.Text)
  968. {
  969. string message = table["message11"].ToString();
  970. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  971. IDC_COMBO_IMGSCANSPEED.Focus();
  972. IDC_COMBO_IMGSCANSPEED.SelectAll();
  973. return false;
  974. }
  975. if ("" == IDC_COMBO_IMGSIZE.Text)
  976. {
  977. string message = table["message12"].ToString();
  978. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  979. IDC_COMBO_IMGSIZE.Focus();
  980. IDC_COMBO_IMGSIZE.SelectAll();
  981. return false;
  982. }
  983. if ("" == IDC_EDIT_MINMAG.Text)
  984. {
  985. string message = table["message13"].ToString();
  986. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  987. IDC_EDIT_MINMAG.Focus();
  988. IDC_EDIT_MINMAG.SelectAll();
  989. return false;
  990. }
  991. if ("" == IDC_EDIT_PARTAREAMIN.Text)
  992. {
  993. string message = table["message14"].ToString();
  994. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  995. IDC_EDIT_PARTAREAMIN.Focus();
  996. IDC_EDIT_PARTAREAMIN.SelectAll();
  997. return false;
  998. }
  999. if ("" == IDC_EDIT_PARTAREAMAX.Text)
  1000. {
  1001. string message = table["message15"].ToString();
  1002. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1003. IDC_EDIT_PARTAREAMAX.Focus();
  1004. IDC_EDIT_PARTAREAMAX.SelectAll();
  1005. return false;
  1006. }
  1007. if ("" == IDC_EDIT_BACKMIN.Text)
  1008. {
  1009. string message = table["message16"].ToString();
  1010. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1011. IDC_EDIT_BACKMIN.Focus();
  1012. IDC_EDIT_BACKMIN.SelectAll();
  1013. return false;
  1014. }
  1015. if ("" == IDC_EDIT_BACKMAX.Text)
  1016. {
  1017. string message = table["message17"].ToString();
  1018. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1019. IDC_EDIT_BACKMAX.Focus();
  1020. IDC_EDIT_BACKMAX.SelectAll();
  1021. return false;
  1022. }
  1023. if ("" == IDC_EDIT_PARTMIN.Text)
  1024. {
  1025. string message = table["message18"].ToString();
  1026. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1027. IDC_EDIT_PARTMIN.Focus();
  1028. IDC_EDIT_PARTMIN.SelectAll();
  1029. return false;
  1030. }
  1031. if ("" == IDC_EDIT_PARTMAX.Text)
  1032. {
  1033. string message = table["message19"].ToString();
  1034. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1035. IDC_EDIT_PARTMAX.Focus();
  1036. IDC_EDIT_PARTMAX.SelectAll();
  1037. return false;
  1038. }
  1039. if ("" == IDC_COMBO_XRAYSCANMODE.Text)
  1040. {
  1041. string message = table["message20"].ToString();
  1042. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1043. IDC_COMBO_XRAYSCANMODE.Focus();
  1044. IDC_COMBO_XRAYSCANMODE.SelectAll();
  1045. return false;
  1046. }
  1047. //if ("" == IDC_COMBO_ANALYXRAYSPEED.Text)
  1048. //{
  1049. // string message = table["message21"].ToString();
  1050. // MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1051. // IDC_COMBO_ANALYXRAYSPEED.Focus();
  1052. // IDC_COMBO_ANALYXRAYSPEED.SelectAll();
  1053. // return false;
  1054. //}
  1055. if ("" == IDC_EDIT_ANALYXRAYAIMVALUE.Text)
  1056. {
  1057. string message = table["message22"].ToString();
  1058. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1059. IDC_EDIT_ANALYXRAYAIMVALUE.Focus();
  1060. IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();
  1061. return false;
  1062. }
  1063. if ("" == tBMeasArea.Text)
  1064. {
  1065. string message = table["message62"].ToString();
  1066. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1067. tBMeasArea.Focus();
  1068. tBMeasArea.SelectAll();
  1069. return false;
  1070. }
  1071. //if ("" == IDC_COMBO_CorrosionExpansionCoefficient.Text)
  1072. //{
  1073. // string message = table["message62"].ToString();
  1074. // MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1075. // IDC_COMBO_CorrosionExpansionCoefficient.Focus();
  1076. // IDC_COMBO_CorrosionExpansionCoefficient.SelectAll();
  1077. // return false;
  1078. //}
  1079. //string pat = @"^(-|\+)?\d{1,8}$";//只能输入1到3位的正负整数
  1080. string pat = @"^-?[0-9]\d*$";//只能限定正负整数,包含0
  1081. string scope = @"^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$";
  1082. string PositiveDecimals = @"^(([1-9]\d*)(\.\d+)?)$|^0\.\d*[1-9]$"; //正浮点数
  1083. string positiveInteger = @"^?[0-9]\d*$";//只能限定正整数,包含0
  1084. string positiveOddNumber = @"[^1,3,5,7,9]";//只能限定正奇数
  1085. Regex rg = new Regex(pat);
  1086. Regex rgScope = new Regex(scope);
  1087. Regex rgPositiveDecimals = new Regex(PositiveDecimals);
  1088. Regex rgpositiveInteger = new Regex(positiveInteger);
  1089. Regex rgpositiveOddNumber = new Regex(positiveOddNumber);
  1090. //是否是正确的数值格式类型判断
  1091. //if(IDC_COMBO_CorrosionExpansionCoefficient.Text!="0")
  1092. //{
  1093. // if (rgpositiveOddNumber.Match(IDC_COMBO_CorrosionExpansionCoefficient.Text.Trim()).Success)
  1094. // {
  1095. // IDC_COMBO_CorrosionExpansionCoefficient.Focus();
  1096. // IDC_COMBO_CorrosionExpansionCoefficient.SelectAll();
  1097. // string message = table["message66"].ToString();
  1098. // MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1099. // return false;
  1100. // }
  1101. //}
  1102. //100倍时屏幕尺寸
  1103. if (false == rg.Match(IDC_EDIT_SCREENWIDTH.Text.Trim()).Success)
  1104. {
  1105. IDC_EDIT_SCREENWIDTH.Focus();
  1106. IDC_EDIT_SCREENWIDTH.SelectAll();
  1107. string message = table["message23"].ToString();
  1108. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1109. return false;
  1110. }
  1111. //x轴行程/mm 起
  1112. if (false == rg.Match(IDC_EDIT_XSTART.Text.Trim()).Success)
  1113. {
  1114. IDC_EDIT_XSTART.Focus();
  1115. IDC_EDIT_XSTART.SelectAll();
  1116. string message = table["message24"].ToString();
  1117. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1118. return false;
  1119. }
  1120. //x轴行程/mm 止
  1121. if (false == rg.Match(IDC_EDIT_XEND.Text.Trim()).Success)
  1122. {
  1123. IDC_EDIT_XEND.Focus();
  1124. IDC_EDIT_XEND.SelectAll();
  1125. string message = table["message25"].ToString();
  1126. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1127. return false;
  1128. }
  1129. //y轴行程/mm 起
  1130. if (false == rg.Match(IDC_EDIT_YSTART.Text.Trim()).Success)
  1131. {
  1132. IDC_EDIT_YSTART.Focus();
  1133. IDC_EDIT_YSTART.SelectAll();
  1134. string message = table["message26"].ToString();
  1135. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1136. return false;
  1137. }
  1138. //y轴行程/mm 止
  1139. if (false == rg.Match(IDC_EDIT_YEND.Text.Trim()).Success)
  1140. {
  1141. IDC_EDIT_YEND.Focus();
  1142. IDC_EDIT_YEND.SelectAll();
  1143. string message = table["message27"].ToString();
  1144. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1145. return false;
  1146. }
  1147. //颗粒面积范围 最小
  1148. if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMIN.Text.Trim()).Success)
  1149. {
  1150. IDC_EDIT_PARTAREAMIN.Focus();
  1151. IDC_EDIT_PARTAREAMIN.SelectAll();
  1152. string message = table["message31"].ToString();
  1153. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1154. return false;
  1155. }
  1156. //颗粒面积范围 最大
  1157. if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMAX.Text.Trim()).Success)
  1158. {
  1159. IDC_EDIT_PARTAREAMAX.Focus();
  1160. IDC_EDIT_PARTAREAMAX.SelectAll();
  1161. string message = table["message32"].ToString();
  1162. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1163. return false;
  1164. }
  1165. //背景灰度范围 最小
  1166. if (false == rg.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)
  1167. {
  1168. IDC_EDIT_BACKMIN.Focus();
  1169. IDC_EDIT_BACKMIN.SelectAll();
  1170. string message = table["message33"].ToString();
  1171. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1172. return false;
  1173. }
  1174. else
  1175. {
  1176. if (false == rgScope.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)
  1177. {
  1178. IDC_EDIT_BACKMIN.Focus();
  1179. IDC_EDIT_BACKMIN.SelectAll();
  1180. string message = table["message34"].ToString();
  1181. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1182. return false;
  1183. }
  1184. }
  1185. //背景灰度范围 最大
  1186. if (false == rg.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)
  1187. {
  1188. IDC_EDIT_BACKMAX.Focus();
  1189. IDC_EDIT_BACKMAX.SelectAll();
  1190. string message = table["message35"].ToString();
  1191. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1192. return false;
  1193. }
  1194. else
  1195. {
  1196. if (false == rgScope.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)
  1197. {
  1198. IDC_EDIT_BACKMAX.Focus();
  1199. IDC_EDIT_BACKMAX.SelectAll();
  1200. string message = table["message36"].ToString();
  1201. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1202. return false;
  1203. }
  1204. }
  1205. //颗粒灰度范围 最小
  1206. if (false == rg.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)
  1207. {
  1208. IDC_EDIT_PARTMIN.Focus();
  1209. IDC_EDIT_PARTMIN.SelectAll();
  1210. string message = table["message37"].ToString();
  1211. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1212. return false;
  1213. }
  1214. else
  1215. {
  1216. if (false == rgScope.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)
  1217. {
  1218. IDC_EDIT_PARTMIN.Focus();
  1219. IDC_EDIT_PARTMIN.SelectAll();
  1220. string message = table["message38"].ToString();
  1221. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1222. return false;
  1223. }
  1224. }
  1225. //颗粒灰度范围 最大
  1226. if (false == rg.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)
  1227. {
  1228. IDC_EDIT_PARTMAX.Focus();
  1229. IDC_EDIT_PARTMAX.SelectAll();
  1230. string message = table["message39"].ToString();
  1231. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1232. return false;
  1233. }
  1234. else
  1235. {
  1236. if (false == rgScope.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)
  1237. {
  1238. IDC_EDIT_PARTMAX.Focus();
  1239. IDC_EDIT_PARTMAX.SelectAll();
  1240. string message = table["message40"].ToString();
  1241. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1242. return false;
  1243. }
  1244. }
  1245. //分析X-ray计数期望值 最大
  1246. if (false == rg.Match(IDC_EDIT_ANALYXRAYAIMVALUE.Text.Trim()).Success)
  1247. {
  1248. IDC_EDIT_ANALYXRAYAIMVALUE.Focus();
  1249. IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();
  1250. string message = table["message41"].ToString();
  1251. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1252. return false;
  1253. }
  1254. //分析X-ray精度对应的时间
  1255. if (false == rg.Match(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()).Success)
  1256. {
  1257. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Focus();
  1258. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.SelectAll();
  1259. string message = table["message42"].ToString();
  1260. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1261. return false;
  1262. }
  1263. //if (false == rgPositiveDecimals.Match(IDC_EDIT_QuantifyMinSize.Text.Trim()).Success)
  1264. //{
  1265. // IDC_EDIT_QuantifyMinSize.Focus();
  1266. // IDC_EDIT_QuantifyMinSize.SelectAll();
  1267. // string message = table["message63"].ToString();
  1268. // MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1269. // return false;
  1270. //}
  1271. pat = @"^[0-9]+(\.[0-9]{1,3})?$"; //只能输入,1到3位小数的正数
  1272. rg = new Regex(pat);
  1273. //最小放大倍数
  1274. if (false == rg.Match(IDC_EDIT_MINMAG.Text.Trim()).Success)
  1275. {
  1276. IDC_EDIT_MINMAG.Focus();
  1277. IDC_EDIT_MINMAG.SelectAll();
  1278. string message = table["message43"].ToString();
  1279. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1280. return false;
  1281. }
  1282. ////最小放大倍数不得小于45倍
  1283. //if (Convert.ToInt32(IDC_EDIT_MINMAG.Text.Trim()) < 45)
  1284. //{
  1285. // IDC_EDIT_MINMAG.Focus();
  1286. // IDC_EDIT_MINMAG.SelectAll();
  1287. // string message = "The minimum magnification cannot be less than 45 times";
  1288. // MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1289. // return false;
  1290. //}
  1291. //再限制,x轴,y轴,的起止的,输入长度,因为现在已经有在mm和um之间的转换,所以这里要限制一下
  1292. //x轴行程/mm 起
  1293. if (IDC_EDIT_XSTART.Text.Length > 4)
  1294. {
  1295. IDC_EDIT_XSTART.Focus();
  1296. IDC_EDIT_XSTART.SelectAll();
  1297. string message = table["message44"].ToString();
  1298. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1299. return false;
  1300. }
  1301. //x轴行程/mm 止
  1302. if (IDC_EDIT_XEND.Text.Length > 4)
  1303. {
  1304. IDC_EDIT_XEND.Focus();
  1305. IDC_EDIT_XEND.SelectAll();
  1306. string message = table["message45"].ToString();
  1307. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1308. return false;
  1309. }
  1310. //y轴行程/mm 起
  1311. if (IDC_EDIT_YSTART.Text.Length > 4)
  1312. {
  1313. IDC_EDIT_YSTART.Focus();
  1314. IDC_EDIT_YSTART.SelectAll();
  1315. string message = table["message46"].ToString();
  1316. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1317. return false;
  1318. }
  1319. //y轴行程/mm 止
  1320. if (IDC_EDIT_YEND.Text.Length > 4)
  1321. {
  1322. IDC_EDIT_YEND.Focus();
  1323. IDC_EDIT_YEND.SelectAll();
  1324. string message = table["message47"].ToString();
  1325. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1326. return false;
  1327. }
  1328. if (Convert.ToInt32(IDC_EDIT_XSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_XEND.Text.Trim()))
  1329. {
  1330. IDC_EDIT_XEND.Focus();
  1331. IDC_EDIT_XEND.SelectAll();
  1332. string message = table["message50"].ToString();
  1333. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1334. return false;
  1335. }
  1336. if (Convert.ToInt32(IDC_EDIT_YSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_YEND.Text.Trim()))
  1337. {
  1338. IDC_EDIT_YEND.Focus();
  1339. IDC_EDIT_YEND.SelectAll();
  1340. string message = table["message53"].ToString();
  1341. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1342. return false;
  1343. }
  1344. //颗粒尺寸范围
  1345. if (Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text.Trim()) > Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text.Trim()))
  1346. {
  1347. IDC_EDIT_PARTAREAMIN.Focus();
  1348. IDC_EDIT_PARTAREAMIN.SelectAll();
  1349. string message = table["message56"].ToString();
  1350. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1351. return false;
  1352. }
  1353. //背景灰度范围
  1354. if (Convert.ToInt32(IDC_EDIT_BACKMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_BACKMAX.Text.Trim()))
  1355. {
  1356. IDC_EDIT_BACKMIN.Focus();
  1357. IDC_EDIT_BACKMIN.SelectAll();
  1358. string message = table["message57"].ToString();
  1359. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1360. return false;
  1361. }
  1362. //颗粒灰度范围
  1363. if (Convert.ToInt32(IDC_EDIT_PARTMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_PARTMAX.Text.Trim()))
  1364. {
  1365. IDC_EDIT_PARTMIN.Focus();
  1366. IDC_EDIT_PARTMIN.SelectAll();
  1367. string message = table["message58"].ToString();
  1368. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1369. return false;
  1370. }
  1371. //最小放大倍数
  1372. if (false == rgpositiveInteger.Match(IDC_EDIT_XrayLimit.Text.Trim()).Success)
  1373. {
  1374. IDC_EDIT_XrayLimit.Focus();
  1375. IDC_EDIT_XrayLimit.SelectAll();
  1376. string message = table["message64"].ToString();
  1377. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1378. return false;
  1379. }
  1380. return true;
  1381. }
  1382. /// <summary>
  1383. /// 判断当前样品台是否在被修改
  1384. /// </summary>
  1385. /// <returns></returns>
  1386. public bool IsModified()
  1387. {
  1388. return m_cstagefile.IsModified();
  1389. }
  1390. /// <summary>
  1391. /// 样品台保存
  1392. /// </summary>
  1393. /// <returns></returns>
  1394. public bool StageSave()
  1395. {
  1396. if (!m_cstagefile.Save())
  1397. {
  1398. log.Error("(OTSProgMgrInfoFun.StageLoad) Failed to save sample station information!");
  1399. return false;
  1400. }
  1401. return true;
  1402. }
  1403. private void btnok_Click(object sender, EventArgs e)
  1404. {
  1405. //先判断
  1406. if (false == CheckSetupValues(1))
  1407. {
  1408. return;
  1409. }
  1410. //先把各个值都保存到各类
  1411. m_cotsprogmgrparamfile.m_runmode = (RunMode)IDC_COMBO_Model.SelectedIndex;
  1412. SaveSEMStageData();
  1413. SaveImageScanPrm();
  1414. SaveCGenParam();
  1415. SaveImageProc();
  1416. SaveXRayParam();
  1417. //然后再把各类传入到SaveInfoToProgMgrFile函数中
  1418. if (false == SaveInfoToProgMgrFile())
  1419. {
  1420. return;
  1421. }
  1422. //保存样品台到文件,在被修改时进行保存
  1423. if (true == IsModified())
  1424. {
  1425. if (true == StageSave())
  1426. {
  1427. this.DialogResult = DialogResult.OK;
  1428. this.Close();
  1429. return;
  1430. }
  1431. else
  1432. {
  1433. string message = table["message54"].ToString();
  1434. log.Error("(ProgMgrInfoForm.btnok_Click) " + message);
  1435. this.Close();
  1436. return;
  1437. }
  1438. }
  1439. }
  1440. //关闭窗体
  1441. private void btncancel_Click(object sender, EventArgs e)
  1442. {
  1443. this.Close();
  1444. }
  1445. #endregion
  1446. #region 选择样品台事件
  1447. private void IDC_COMBO_STAGE_SelectedIndexChanged(object sender, EventArgs e)
  1448. {
  1449. //样品台
  1450. if (!StageLoad())
  1451. {
  1452. this.Close();
  1453. return;//加载失败返回
  1454. }
  1455. ThisSetIsModify();
  1456. //加载相关参数信息
  1457. //StageLoad();
  1458. //LoadSEMStageData();
  1459. //LoadImageScanPrm();
  1460. //LoadCGenParam();
  1461. //LoadImageProc();
  1462. //LoadXRayParam();
  1463. }
  1464. /// <summary>
  1465. /// 通过id设置当前正在工作的样品台
  1466. /// </summary>
  1467. /// <param name="id"></param>
  1468. public void SetWorkingStageId(int id)
  1469. {
  1470. m_cstagefile.SetWorkingStageId(id);
  1471. }
  1472. /// <summary>
  1473. /// 设置当前样品台正在被修改中
  1474. /// </summary>
  1475. /// <param name="yn"></param>
  1476. public void SetModify(bool yn)
  1477. {
  1478. m_cstagefile.SetModify(true);
  1479. }
  1480. /// <summary>
  1481. /// 设置当前窗体可以保存了
  1482. /// </summary>
  1483. private void ThisSetIsModify()
  1484. {
  1485. ComboBoxItem cbi = new ComboBoxItem();
  1486. if (IDC_COMBO_STAGE.Items.Count > 0)
  1487. if (null != IDC_COMBO_STAGE.SelectedItem)
  1488. {
  1489. cbi = (ComboBoxItem)IDC_COMBO_STAGE.SelectedItem;
  1490. SetWorkingStageId(Convert.ToInt32(cbi.Value));
  1491. SetModify(true);
  1492. btnok.Enabled = true;
  1493. }
  1494. }
  1495. #endregion
  1496. #region 监视控件改变状态事件
  1497. private void IDC_EDIT_SCREENWIDTH_TextChanged(object sender, EventArgs e)
  1498. {
  1499. ThisSetIsModify();
  1500. }
  1501. private void IDC_COMBO_XDIREC_SelectedIndexChanged(object sender, EventArgs e)
  1502. {
  1503. ThisSetIsModify();
  1504. }
  1505. private void IDC_EDIT_XSTART_TextChanged(object sender, EventArgs e)
  1506. {
  1507. ThisSetIsModify();
  1508. }
  1509. private void IDC_EDIT_XEND_TextChanged(object sender, EventArgs e)
  1510. {
  1511. ThisSetIsModify();
  1512. }
  1513. private void IDC_COMBO_YDIRECT_SelectedIndexChanged(object sender, EventArgs e)
  1514. {
  1515. ThisSetIsModify();
  1516. }
  1517. private void IDC_EDIT_YSTART_TextChanged(object sender, EventArgs e)
  1518. {
  1519. ThisSetIsModify();
  1520. }
  1521. private void IDC_EDIT_YEND_TextChanged(object sender, EventArgs e)
  1522. {
  1523. ThisSetIsModify();
  1524. }
  1525. private void IDC_EDIT_MINMAG_TextChanged(object sender, EventArgs e)
  1526. {
  1527. ThisSetIsModify();
  1528. }
  1529. private void IDC_COMBO_STOPMODE_SelectedIndexChanged(object sender, EventArgs e)
  1530. {
  1531. ThisSetIsModify();
  1532. }
  1533. private void IDC_EDIT_STOP_TIME_TextChanged(object sender, EventArgs e)
  1534. {
  1535. ThisSetIsModify();
  1536. }
  1537. private void IDC_EDIT_STOP_FIELD_NUM_TextChanged(object sender, EventArgs e)
  1538. {
  1539. ThisSetIsModify();
  1540. }
  1541. private void IDC_EDIT_STOP_INCA_NUM_TextChanged(object sender, EventArgs e)
  1542. {
  1543. ThisSetIsModify();
  1544. }
  1545. private void IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged(object sender, EventArgs e)
  1546. {
  1547. ThisSetIsModify();
  1548. }
  1549. private void IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1550. {
  1551. ThisSetIsModify();
  1552. }
  1553. private void IDC_COMBO_IMGSIZE_SelectedIndexChanged(object sender, EventArgs e)
  1554. {
  1555. ThisSetIsModify();
  1556. }
  1557. private void IDC_EDIT_SAMPLENAME_TextChanged(object sender, EventArgs e)
  1558. {
  1559. ThisSetIsModify();
  1560. }
  1561. private void IDC_MEAS_SWITCH_CheckedChanged(object sender, EventArgs e)
  1562. {
  1563. ThisSetIsModify();
  1564. }
  1565. private void IDC_EDIT_MEASUREPARAMPATH_TextChanged(object sender, EventArgs e)
  1566. {
  1567. ThisSetIsModify();
  1568. }
  1569. private void IDC_EDIT_ANALYSESTDLIBPATH_TextChanged(object sender, EventArgs e)
  1570. {
  1571. ThisSetIsModify();
  1572. }
  1573. private void IDC_EDIT_STDLIBNAME_TextChanged(object sender, EventArgs e)
  1574. {
  1575. ThisSetIsModify();
  1576. }
  1577. private void IDC_EDIT_PARTAREAMIN_TextChanged(object sender, EventArgs e)
  1578. {
  1579. ThisSetIsModify();
  1580. }
  1581. private void IDC_EDIT_PARTAREAMAX_TextChanged(object sender, EventArgs e)
  1582. {
  1583. ThisSetIsModify();
  1584. }
  1585. private void IDC_EDIT_BACKMIN_TextChanged(object sender, EventArgs e)
  1586. {
  1587. ThisSetIsModify();
  1588. }
  1589. private void IDC_EDIT_BACKMAX_TextChanged(object sender, EventArgs e)
  1590. {
  1591. ThisSetIsModify();
  1592. }
  1593. private void IDC_EDIT_PARTMIN_TextChanged(object sender, EventArgs e)
  1594. {
  1595. ThisSetIsModify();
  1596. }
  1597. private void IDC_EDIT_PARTMAX_TextChanged(object sender, EventArgs e)
  1598. {
  1599. ThisSetIsModify();
  1600. }
  1601. private void IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)
  1602. {
  1603. ThisSetIsModify();
  1604. }
  1605. private void IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)
  1606. {
  1607. ComboBox cbBGREMOVETYPE = (ComboBox)sender;
  1608. int selectValue=Convert.ToInt32(((OTSMeasureApp.ComboBoxItem)cbBGREMOVETYPE.Items[cbBGREMOVETYPE.SelectedIndex]).Value);
  1609. if (selectValue == (int)otsdataconst.OTS_AUTOBGREMOVETYPE.MANUAL)
  1610. {
  1611. IDC_COMBO_AUTOBGREMOVETYP.Enabled = false;
  1612. }
  1613. else
  1614. {
  1615. IDC_COMBO_AUTOBGREMOVETYP.Enabled = true;
  1616. }
  1617. ThisSetIsModify();
  1618. }
  1619. private void IDC_COMBO_SEARCHXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1620. {
  1621. ThisSetIsModify();
  1622. }
  1623. private void IDC_EDIT_SEARCHXRAYCOUNTLIMIT_TextChanged(object sender, EventArgs e)
  1624. {
  1625. ThisSetIsModify();
  1626. }
  1627. private void IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged(object sender, EventArgs e)
  1628. {
  1629. ThisSetIsModify();
  1630. }
  1631. private void IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1632. {
  1633. ThisSetIsModify();
  1634. }
  1635. private void IDC_EDIT_ANALYXRAYAIMVALUE_TextChanged(object sender, EventArgs e)
  1636. {
  1637. ThisSetIsModify();
  1638. }
  1639. private void IDC_COMBO_TECHNOLOGY_SelectedIndexChanged(object sender, EventArgs e)
  1640. {
  1641. ThisSetIsModify();
  1642. }
  1643. private void IDC_STOP_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1644. {
  1645. ThisSetIsModify();
  1646. }
  1647. private void IDC_STOP_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)
  1648. {
  1649. ThisSetIsModify();
  1650. }
  1651. private void IDC_STOP_FIELD_SWITCH_CheckedChanged(object sender, EventArgs e)
  1652. {
  1653. ThisSetIsModify();
  1654. }
  1655. private void IDC_STOP_PARTICAL_SWITCH_CheckedChanged(object sender, EventArgs e)
  1656. {
  1657. ThisSetIsModify();
  1658. }
  1659. private void IDC_FETCH_IMAGE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1660. {
  1661. ThisSetIsModify();
  1662. }
  1663. private void IDC_SCAN_SPEED_SWITCH_CheckedChanged(object sender, EventArgs e)
  1664. {
  1665. ThisSetIsModify();
  1666. }
  1667. private void IDC_IMAGE_SIZE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1668. {
  1669. ThisSetIsModify();
  1670. }
  1671. private void IDC_PART_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)
  1672. {
  1673. ThisSetIsModify();
  1674. }
  1675. private void IDC_PART_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)
  1676. {
  1677. ThisSetIsModify();
  1678. }
  1679. private void IDC_BACK_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)
  1680. {
  1681. ThisSetIsModify();
  1682. }
  1683. private void IDC_BACK_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)
  1684. {
  1685. ThisSetIsModify();
  1686. }
  1687. private void IDC_PART_GRAY_SWITCH_CheckedChanged(object sender, EventArgs e)
  1688. {
  1689. ThisSetIsModify();
  1690. }
  1691. private void IDC_PART_GRAY_MAX_CheckedChanged(object sender, EventArgs e)
  1692. {
  1693. ThisSetIsModify();
  1694. }
  1695. private void IDC_XRAY_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1696. {
  1697. ThisSetIsModify();
  1698. }
  1699. private void IDC_XRAY_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)
  1700. {
  1701. ThisSetIsModify();
  1702. }
  1703. private void IDC_XRAY_COUNT_SWITCH_CheckedChanged(object sender, EventArgs e)
  1704. {
  1705. ThisSetIsModify();
  1706. }
  1707. private void cBMeasShape_SelectedIndexChanged(object sender, EventArgs e)
  1708. {
  1709. ThisSetIsModify();
  1710. }
  1711. private void tBMeasArea_TextChanged(object sender, EventArgs e)
  1712. {
  1713. ThisSetIsModify();
  1714. }
  1715. private void IDC_SYS_LIB_CheckedChanged(object sender, EventArgs e)
  1716. {
  1717. ThisSetIsModify();
  1718. }
  1719. #endregion
  1720. private void IDC_COMBO_STDSelect_SelectedIndexChanged(object sender, EventArgs e)
  1721. {
  1722. ThisSetIsModify();
  1723. }
  1724. private void IDC_COMBO_USINGXRAYS_SelectedIndexChanged(object sender, EventArgs e)
  1725. {
  1726. ThisSetIsModify();
  1727. }
  1728. private void IDC_COMBO_Model_SelectedIndexChanged(object sender, EventArgs e)
  1729. {
  1730. ThisSetIsModify();
  1731. }
  1732. private void btn_StopMode_Click(object sender, EventArgs e)
  1733. {
  1734. if (StopModeDialog == null)
  1735. {
  1736. StopModeDialog = new frmMeasureStopMode();
  1737. StopModeDialog.FieldMode = m_cotsimgscanprm.GetStopParamFields();
  1738. StopModeDialog.TimeMode = m_cotsimgscanprm.GetStopParamMeasTime();
  1739. StopModeDialog.ParticleMode = m_cotsimgscanprm.GetStopParamParticles();
  1740. StopModeDialog.AreaMode = m_cotsimgscanprm.GetStopParamArea();
  1741. StopModeDialog.StopMode = tB_StopMode.Text;
  1742. }
  1743. DialogResult result = StopModeDialog.ShowDialog();
  1744. if (result == DialogResult.OK)
  1745. {
  1746. string[] rst = StopModeDialog.StopMode.Split(',');
  1747. string str = "";
  1748. for (int k = 0; k < rst.Length; k++)
  1749. {
  1750. str += rst[k].Split(':')[0] + " + ";
  1751. }
  1752. tB_StopMode.Text = str.Substring(0, str.Length - 3);
  1753. }
  1754. }
  1755. private void IDC_COMBO_CorrosionExpansionCoefficient_TextChanged(object sender, EventArgs e)
  1756. {
  1757. ThisSetIsModify();
  1758. }
  1759. private void button_SpPart_Click(object sender, EventArgs e)
  1760. {
  1761. }
  1762. private void checkBox_Run_CheckedChanged(object sender, EventArgs e)
  1763. {
  1764. }
  1765. }
  1766. public class ComboBoxItem
  1767. {
  1768. private string _text = null;
  1769. private object _value = null;
  1770. public string Text { get { return this._text; } set { this._text = value; } }
  1771. public object Value { get { return this._value; } set { this._value = value; } }
  1772. public override string ToString()
  1773. {
  1774. return this._text;
  1775. }
  1776. }
  1777. }