ProgMgrInfoForm.cs 78 KB

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