COTSMeasureParam.cs 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409
  1. using OTSModelSharp;
  2. using OTSDataType;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.IO;
  8. using OTSModelSharp.ResourceManage;
  9. using static OTSModelSharp.ResourceManage.ResourceID;
  10. using static OTSModelSharp.ResourceManage.ResourceData;
  11. using static OTSDataType.otsdataconst;
  12. using System.Windows.Forms;
  13. using OTSMeasureApp._0_OTSModel.OTSDataType;
  14. namespace OTSMeasureApp
  15. {
  16. //设置线程状态
  17. public enum MSR_RUN_TYPE
  18. {
  19. RUNMEASURE = 1, //normal
  20. RUNSampleHoleImage = 2 //take photo of the measure area.
  21. };
  22. enum SAMPLE_FAULT_WARN_CODE
  23. {
  24. INVALID = -1,
  25. MIN = 0,
  26. SEM_DATA_ERROR = 0,
  27. AREA_OUTSIDE_HOLE = 1,
  28. RESOLUTION_LOW = 2,
  29. FINISHED = 3,
  30. NO_ERROR_WARNING = 4,
  31. FILE_NOT_SAVED = 5,
  32. MAX = 5
  33. };
  34. enum SAMPLE_CHECK_RESULT_TYPE
  35. {
  36. INVALID = -1,
  37. MIN = 0,
  38. SWITCH_ON = 0,
  39. FINISHED = 1,
  40. SETTING_ERROR = 2,
  41. SETTING_WARNING = 3,
  42. MEASURABLE = 4,
  43. NO_ERROR_WARNING = 5,
  44. MAX = 5
  45. };
  46. public class COTSMeasureParam
  47. {
  48. OTSIncAMeasureAppForm m_MeasureAppFrom = null;
  49. /// <summary></summary>
  50. /// <remarks>创建</remarks>
  51. private COTSMsrPrjResultData resultData;
  52. //参数文件
  53. private COTSDefaultParam defaultParam = null;
  54. //样品台文件(读取样品台数据等)
  55. private CStageParam stageParam = null;
  56. private CSpecialGrayRangeParam specialRanges = null;
  57. //测量样品链表
  58. List<COTSSample> m_MeasureSampleList = new List<COTSSample>();
  59. NLog.Logger log ;
  60. public CSpecialGrayRangeParam SpecialRanges { get => specialRanges; set => specialRanges = value; }
  61. public CStageParam GetStageParam()
  62. {
  63. return stageParam;
  64. }
  65. public void SetStageParam(CStageParam value)
  66. {
  67. stageParam = value;
  68. }
  69. public COTSDefaultParam GetDefaultParam()
  70. {
  71. return defaultParam;
  72. }
  73. public void SetDefaultParam(COTSDefaultParam value)
  74. {
  75. defaultParam = value;
  76. }
  77. public COTSMsrPrjResultData GetResultData()
  78. {
  79. return resultData;
  80. }
  81. public void SetResultData(COTSMsrPrjResultData value)
  82. {
  83. resultData = value;
  84. }
  85. public COTSMeasureParam(OTSIncAMeasureAppForm MeasureApp)
  86. {
  87. log = NLog.LogManager.GetCurrentClassLogger();
  88. m_MeasureAppFrom = MeasureApp;
  89. SetResultData(new COTSMsrPrjResultData());
  90. }
  91. //检查参数文件是否存在
  92. public bool LoadParamFile()
  93. {
  94. //加载样品参数文件: \Config\SysData\OTSProgMgrParam.pmf
  95. SetDefaultParam(new COTSDefaultParam());
  96. return GetDefaultParam().LoadInfoFromProgMgrFile();
  97. }
  98. //检查参数样品台文件是否存在
  99. public bool LoadStageParamFile()
  100. {
  101. SetStageParam(new CStageParam());
  102. // 加载样品台文件; \Config\SysData\OTSStage.stg
  103. if (!GetStageParam().Load(true, false))
  104. {
  105. return false;
  106. }
  107. return true;
  108. }
  109. public bool LoadSpecialGrayRangeParamFile()
  110. {
  111. SpecialRanges = new CSpecialGrayRangeParam();
  112. if (!SpecialRanges.LoadParam())
  113. {
  114. return false;
  115. }
  116. return true;
  117. }
  118. //获取系统文件是否存在和有效
  119. public bool InitResultData(bool bNewFileFlag = true)
  120. {
  121. //打开文件,则文件中保存有样品台信息,不需要使用系统样品名信息
  122. if (bNewFileFlag)
  123. {
  124. //设置样品台参数
  125. CStage Stage = GetStageParam().GetWorkingStage();
  126. if (null == Stage)
  127. {
  128. return false;
  129. }
  130. GetResultData().SetStage(Stage);
  131. // 设置 SEM stage data
  132. CSEMStageData SEMData = GetDefaultParam().GetStageDataParam();
  133. if (null == SEMData)
  134. {
  135. return false;
  136. }
  137. GetResultData().SetSEMStageData(SEMData);
  138. }
  139. //设置 general parameter
  140. COTSGeneralParam GenParam = GetDefaultParam().GetGenParam();
  141. if (null == GenParam)
  142. {
  143. return false;
  144. }
  145. GetResultData().SetGenParam(GenParam);
  146. if (GetResultData().GetPathName()=="")
  147. {
  148. GetResultData().SetPathName("Untitled");
  149. }
  150. GetResultData().SystemTypeId = GetDefaultParam().SystemTypeId;
  151. return true;
  152. }
  153. //新建样品工作文件 0:报错 1:正常 2:取消
  154. public int CreateNewFile()
  155. {
  156. if (GetResultData().IsModified()) // 文件被修改
  157. {
  158. int iRev = m_MeasureAppFrom.ShowSaveInfoMsgBox();
  159. if ((int)MessageBoxRev.DIALOG_YES == iRev)
  160. {
  161. if (!GetResultData().Save())
  162. {
  163. return 0;
  164. }
  165. }
  166. else if((int)MessageBoxRev.DIALOG_CANCEL == iRev)
  167. {
  168. return 2;
  169. }
  170. }
  171. //新建新的工作文件
  172. //重新生成一个工作文件对象
  173. COTSMsrPrjResultData ProjDataMgr = new COTSMsrPrjResultData();
  174. GetResultData().SetPathName("Untitled");
  175. SetResultData(ProjDataMgr);
  176. this.LoadStageParamFile();
  177. if (!this.InitResultData())
  178. {
  179. return 0;
  180. }
  181. return 1;
  182. }
  183. //将样品台坐标转换为Sem 坐标
  184. public PointF ConvertOTSToSemCoord(PointF POTSCoord)
  185. {
  186. System.Drawing.PointF VSemCoord = new System.Drawing.PointF();
  187. GetDefaultParam().GetStageDataParam().ConvertOTSToSEMCoord(POTSCoord, ref VSemCoord);
  188. return VSemCoord;
  189. }
  190. //将Sem 坐标转换为样品台坐标
  191. public PointF ConverSEMToOTSCoord(PointF PSEMCoord)
  192. {
  193. System.Drawing.PointF VOTSCoord = new System.Drawing.PointF();
  194. GetDefaultParam().GetStageDataParam().ConvertSEMToOTSCoord(PSEMCoord, ref VOTSCoord);
  195. return VOTSCoord;
  196. }
  197. public OTSSampleVisualPropertyInfo AddNewSampleMeasure(string a_strHoleName = "")
  198. {
  199. COTSSample NewSample = new COTSSample();
  200. SetSampleDefaultPara(ref NewSample, a_strHoleName);
  201. //NewSample.
  202. //添加样品
  203. GetResultData().AddSample(NewSample);
  204. // 获取样品的属性值
  205. OTSSampleVisualPropertyInfo MeasureInfo = new OTSSampleVisualPropertyInfo(NewSample, defaultParam.GetSysType());
  206. return MeasureInfo;
  207. }
  208. public void InitWorkingSampleData(int startfieldNo)
  209. {
  210. COTSSample Sample = GetWorkSample();
  211. if (Sample == null) return ;
  212. var sname= Sample.GetName();
  213. var pathname = resultData.GetFolderName(resultData.GetPathName());
  214. var sampleResultFolder = pathname + "\\" + sname;
  215. if (Directory.Exists(sampleResultFolder))
  216. {
  217. resultData.DeleteWorkingSampleFieldDataByFieldNo(startfieldNo);
  218. //Directory.Delete(sampleResultFolder, true);
  219. var flds = Sample.GetFieldsData();
  220. foreach (var f in flds)
  221. {
  222. if (f.GetMeasureSequence() >= startfieldNo)
  223. {
  224. f.ClearAllMeausredData();
  225. f.SetIsMeasureComplete(false);
  226. }
  227. }
  228. }
  229. var sta = Sample.GetMsrStatus();
  230. sta.ClearCompletedFieldsInfo();
  231. sta.SetStatus(OTS_MSR_SAMPLE_STATUS.UNMEASURED);
  232. var rsts = Sample.GetMsrResults();
  233. var itms = rsts.GetResultItems();
  234. itms.Clear();
  235. rsts.SetResultItems(itms);
  236. rsts.SetMeasuredArea(0);
  237. rsts.SetRatio(0);
  238. }
  239. public OTSSampleVisualPropertyInfo GetWorkingSampleVisualPropertyInfo()
  240. {
  241. COTSSample Sample = GetWorkSample();
  242. if (Sample == null) return null;
  243. OTSSampleVisualPropertyInfo MeasureInfo = new OTSSampleVisualPropertyInfo(Sample, defaultParam.GetSysType());
  244. return MeasureInfo;
  245. }
  246. protected COTSSample SetSampleDefaultPara(ref COTSSample pSample, String a_strHoleName)
  247. {
  248. // get new sample name
  249. String strNewSampleName = GetNewSampleName();
  250. // make sure the new sample name is not an empty string
  251. strNewSampleName.Trim();
  252. // get a suitable sample hole for the new sample
  253. CHole pHole = SelectASmpleHole(a_strHoleName);
  254. // check the sample hole
  255. if (pHole == null)
  256. {
  257. // failed to get sample hole for the new sample
  258. return null;
  259. }
  260. // measurement area
  261. CDomain pMsrArea = CalculateDefaultArea(pHole);
  262. // measure data parameters containing particle analysis std, image scan parameter, image process parameter and x-ray parameter
  263. CSampleParam poMsrParams = new CSampleParam();
  264. poMsrParams.m_nPackId = GetDefaultParam().SystemTypeId;
  265. poMsrParams.m_runmode = GetDefaultParam().m_runmode;
  266. var m_pParam = GetDefaultParam().GetGenParam();
  267. MEMBRANE_TYPE a_nVal = (MEMBRANE_TYPE)m_pParam.GetMembraneType();
  268. poMsrParams.SetImageScanParam(GetDefaultParam().GetImageScanParam ());
  269. poMsrParams.SetImageProcessParam(GetDefaultParam().GetImageProcParam());
  270. poMsrParams.SetXRayParam(GetDefaultParam().GetXRayParam());
  271. String sSTDName = m_pParam.GetSTDSelect();
  272. poMsrParams.SetSTDName(sSTDName);
  273. poMsrParams.SetSteelTechnology((STEEL_TECHNOLOGY)m_pParam.GetSteelTechnology());
  274. poMsrParams.SetSpecialGrayRangeParam(SpecialRanges);
  275. // set sample parameters
  276. pSample.SetName(strNewSampleName);
  277. pSample.SetSampleHoleName(pHole.GetName());
  278. pSample.SetSwitch(m_pParam.GetMeasurementSwitch());
  279. poMsrParams.SetSysSTDSwitch(m_pParam.GetSysSTD());
  280. pSample.SetMsrDomain(pMsrArea);
  281. //pSample.SetMembraneType(a_nVal);
  282. pSample.SetMsrParams(poMsrParams);
  283. CSEMDataMsr semData = new CSEMDataMsr();
  284. var m_pSEMStageData = GetDefaultParam().GetStageDataParam();
  285. var imageScanParam = GetDefaultParam().GetImageScanParam();
  286. string resol = imageScanParam.GetImageResulotion().ToString();
  287. double resWidth = Convert.ToDouble(resol.Split('_')[1]);
  288. double resHeight = Convert.ToDouble(resol.Split('_')[2]);
  289. double heightWidthRatio = resHeight / resWidth;
  290. semData.SetScanFieldSize100(m_pSEMStageData.GetScanFieldSize100());
  291. double fieldHeight = m_pSEMStageData.GetScanFieldSize100() * heightWidthRatio;
  292. semData.SetScanFieldHeight100((int)fieldHeight);
  293. pSample.SetSEMDataMsr(semData);
  294. return pSample;
  295. }
  296. public String GetNewSampleName()
  297. {
  298. // new sample name
  299. String strNewSmplName = "";
  300. // safety check
  301. var m_pParam = GetDefaultParam().GetGenParam();
  302. if (m_pParam == null)
  303. {
  304. // shouldn't happen, invalid general parameter pointer.
  305. return strNewSmplName;
  306. }
  307. // new sample name base
  308. String strNewSmplNameBase = m_pParam.GetSampleName() + @"{0}";
  309. int nIndex = 1;
  310. do
  311. {
  312. // new sample name is new sample name base + number string
  313. strNewSmplName = string.Format(strNewSmplNameBase, nIndex);
  314. ++nIndex;
  315. }
  316. // make sure that the new sample name is not same with any sample in the samples list
  317. while (SameNameInList(strNewSmplName));
  318. // new sample name
  319. return strNewSmplName;
  320. }
  321. public bool SameNameInList(String a_strSampleName, int a_nExclude = -1)
  322. {
  323. // make sure the input sample name is not empty
  324. a_strSampleName.Trim();
  325. if (a_strSampleName == "")
  326. {
  327. // shouldn't happen, input name is an empty string
  328. return false;
  329. }
  330. // go through sample list
  331. int nIndex = 0;
  332. var m_listSamples = GetResultData().GetSampleList();
  333. foreach (var pSample in m_listSamples)
  334. {
  335. // return TRUE if this is not an exclude sample and its name is same with input
  336. String strSampleName = pSample.GetName();
  337. if (nIndex != a_nExclude && strSampleName.CompareTo(a_strSampleName) == 0)
  338. {
  339. // find a same name sample
  340. return true;
  341. }
  342. ++nIndex;
  343. }
  344. // no, same name sample in the same list, return FALSE
  345. return false;
  346. }
  347. // select a suitable sample hole for a new sample
  348. public CHole SelectASmpleHole(String a_strHoleName /*= _T("")*/)
  349. {
  350. // get holes list of the stage
  351. var m_pStage = GetStageParam().GetWorkingStage();
  352. List<CHole> listHoles = m_pStage.GetHoleList();
  353. //返回样品孔对象
  354. CHole cReHole ;
  355. // make sure the holes list is not empty
  356. if (listHoles.Count == 0)
  357. {
  358. // shouldn't happen, stage have no hole.
  359. return null;
  360. }
  361. // check the input hole name
  362. a_strHoleName.Trim();
  363. if (a_strHoleName != "")
  364. {
  365. // try to find matched hole
  366. for (int i = 0; i < listHoles.Count; i++)
  367. {
  368. if (listHoles[i].GetName() == a_strHoleName)
  369. {
  370. cReHole = listHoles[i];
  371. return cReHole;
  372. }
  373. }
  374. }
  375. // can't find a matched hole, then pick the first empty hole
  376. // go through the holes list
  377. foreach (var pHole in listHoles)
  378. {
  379. // has this hole any sample in it?
  380. String strHoleName = pHole.GetName();
  381. bool IsChanged = false;
  382. var m_listSamples = GetResultData().GetSampleList();
  383. foreach (COTSSample sampleItem in m_listSamples)
  384. {
  385. if (strHoleName == sampleItem.GetSampleHoleName())
  386. {
  387. IsChanged = true;
  388. }
  389. }
  390. if (!IsChanged)
  391. {
  392. return pHole;
  393. }
  394. }
  395. // no empty hole, then the first hole will be the one
  396. return listHoles[0];
  397. }
  398. public CDomain CalculateDefaultArea(CHole a_pHole)
  399. {
  400. RectangleF rectHole = a_pHole.GetDomainRect();
  401. System.Drawing.PointF ptCenter = new System.Drawing.PointF((rectHole.Left + rectHole.Right) / 2, (rectHole.Top + rectHole.Bottom) / 2);
  402. var m_pParam = GetDefaultParam().GetGenParam();
  403. DOMAIN_SHAPE nShape = m_pParam.GetShape();
  404. double dArea = m_pParam.GetArea() * 1000000;
  405. System.Drawing.PointF ptLeftTop = new System.Drawing.Point();
  406. System.Drawing.SizeF ptSize = new System.Drawing.Size();
  407. int nEdge = 0;
  408. int nRadius = 0;
  409. switch ((int)nShape)
  410. {
  411. case (int)DOMAIN_SHAPE.RECTANGLE:
  412. nEdge = (int)Math.Sqrt(dArea) / 2;
  413. ptLeftTop.X = ptCenter.X - nEdge;
  414. ptLeftTop.Y = ptCenter.Y - nEdge;
  415. ptSize.Width = ptCenter.X + nEdge - ptLeftTop.X;
  416. ptSize.Height = ptCenter.Y + nEdge - ptLeftTop.Y;
  417. break;
  418. case (int)DOMAIN_SHAPE.ROUND:
  419. nRadius = (int)Math.Sqrt(dArea / 3.1415926);
  420. ptLeftTop.X = ptCenter.X - nRadius;
  421. ptLeftTop.Y = ptCenter.Y - nRadius;
  422. ptSize.Width = ptCenter.X + nRadius - ptLeftTop.X;
  423. ptSize.Height = ptCenter.Y + nRadius - ptLeftTop.Y;
  424. break;
  425. }
  426. RectangleF MsrRect = new RectangleF(ptLeftTop, ptSize);
  427. CDomain pMsrArea = new CDomain(nShape, MsrRect);
  428. return pMsrArea;
  429. }
  430. //设置工作样品的属性值
  431. public bool SetSampleParamVal(OTS_SAMPLE_PROP_GRID_ITEMS ItemId, OTS_ITEM_TYPES ValType, object objVal)
  432. {
  433. COTSSample WSample = GetResultData().GetWorkingSample();
  434. OTSSampleVisualPropertyInfo MeasureInfo = new OTSSampleVisualPropertyInfo(WSample, defaultParam.GetSysType());
  435. bool bSetFalg = false;
  436. bSetFalg = MeasureInfo.SetParamVal(ItemId, ValType, objVal);
  437. if (bSetFalg)
  438. {
  439. GetResultData().SetModify(true);
  440. }
  441. return bSetFalg;
  442. }
  443. //获取工作样品名称
  444. public string GetWorkSampleName()
  445. {
  446. COTSSample WSample = GetResultData().GetWorkingSample();
  447. if (null == WSample)
  448. {
  449. return "";
  450. }
  451. string sWorkSampleName = WSample.GetName();
  452. if ("" == sWorkSampleName)
  453. {
  454. return "";
  455. }
  456. return sWorkSampleName;
  457. }
  458. //设置工作样品
  459. //string sNewWorkSampleName: 新工作样品
  460. public bool SetWorkSample(string sNewWorkSampleName)
  461. {
  462. if ("" == sNewWorkSampleName)
  463. {
  464. return false;
  465. }
  466. if (!GetResultData().SetWorkingSampleByName(sNewWorkSampleName))
  467. {
  468. return false;
  469. }
  470. return true;
  471. }
  472. //获取工作样品
  473. // 返回工作样品对象
  474. public COTSSample GetWorkSample()
  475. {
  476. COTSSample WSample = GetResultData().GetWorkingSample();
  477. return WSample;
  478. }
  479. //删除工作样品
  480. //string sWorkSampleName : 删除工作样品名称
  481. public bool DeleteWorkSample(string sWorkSampleName)
  482. {
  483. return GetResultData().DeleteSampleByName(sWorkSampleName);
  484. }
  485. // 获取样品总数
  486. //返回样品总数
  487. public int GetSampleCount()
  488. {
  489. return GetResultData().GetSampleList().Count();
  490. }
  491. //改变工作样品名称
  492. //String sWSampleNewName
  493. public bool ChangeWorkSampleName(String sWSampleNewName)
  494. {
  495. if (!GetResultData().IsValidSampleName(sWSampleNewName))
  496. {
  497. return false;
  498. }
  499. COTSSample WorkSample = GetResultData().GetWorkingSample();
  500. if (null == WorkSample)
  501. {
  502. return false;
  503. }
  504. WorkSample.SetName(sWSampleNewName);
  505. GetResultData().SetModify(true);
  506. return true;
  507. }
  508. //移动工作样品到其他样品孔,样品孔名称和测量区域都要改变,重新设置工作样品参数
  509. public void SetWorkSampleHoleAndMeasureArea(SampleMeasurePara SMeasurePara)
  510. {
  511. COTSSample WSample = GetResultData().GetWorkingSample();
  512. if (null == WSample)
  513. {
  514. return ;
  515. }
  516. CDomain Domain = new CDomain();
  517. Domain.SetShape((otsdataconst.DOMAIN_SHAPE)SMeasurePara.iShape);
  518. Domain.SetRectDomain(SMeasurePara.MeasureRect);
  519. if (SMeasurePara.DrawPolygonPointList != null)
  520. {
  521. List<Point> PolygonPoint = new List<Point>();
  522. foreach (var item in SMeasurePara.DrawPolygonPointList)
  523. {
  524. PolygonPoint.Add(new Point((int)item.X, (int)item.Y));
  525. }
  526. Domain.SetPolygonPoint(PolygonPoint);
  527. }
  528. WSample.SetSampleHoleName(SMeasurePara.sampleHoleName);
  529. WSample.SetMsrDomain(Domain);
  530. return ;
  531. }
  532. //设置测量区域的形状 (通过RIBBON 上的画圆,画矩形 设置)
  533. //int iShape: 测量区域形状 0: 圆形; 1 :矩形
  534. public void SetMeasureAreaShape(ShapeType iShape)
  535. {
  536. COTSSample WSample = GetResultData().GetWorkingSample();
  537. if (null == WSample)
  538. {
  539. return;
  540. }
  541. CDomain Domain = new CDomain();
  542. Domain.SetShape((otsdataconst.DOMAIN_SHAPE)iShape);
  543. }
  544. public bool SetWorkSampleParamLock(bool ParaLockFlag)
  545. {
  546. COTSSample WSample = GetResultData().GetWorkingSample();
  547. if (null == WSample)
  548. {
  549. return false;
  550. }
  551. WSample.SetParamLock(ParaLockFlag);
  552. GetResultData().SetModify(true);
  553. return true;
  554. }
  555. public bool CheckSampleParam(bool bCheckFlag)
  556. {
  557. m_MeasureSampleList.Clear();
  558. List<COTSSample> MSampleList = new List<COTSSample>();
  559. if (!CheckMeasureParam(GetResultData(), ref MSampleList, bCheckFlag))
  560. {
  561. return false;
  562. }
  563. if (MSampleList.Count > 0)
  564. {
  565. m_MeasureSampleList = MSampleList;
  566. return true;
  567. }
  568. return false;
  569. }
  570. public bool CheckMeasureParam(COTSMsrPrjResultData a_pProjMgrFile, ref List<COTSSample> a_listMeasuableSamples, bool a_bCheckSetting)
  571. {
  572. // go through the sample list to check setting parameters
  573. int nSwitchSmplNo = 0;
  574. int nCompletedSmplNo = 0;
  575. int nErrorSmplNo = 0;
  576. int nWarningSmplNo = 0;
  577. List<String> listSamplMessages = new List<string>();
  578. List<COTSSample> listSamples = a_pProjMgrFile.GetSampleList();
  579. List<COTSSample> listMeasurableSamples = new List<COTSSample>();
  580. List<COTSSample> listWithWarningMeasurableSamples = new List<COTSSample>();
  581. foreach (var pSample in listSamples)
  582. {
  583. // is the sample switch on
  584. if (pSample.GetSwitch())
  585. {
  586. ++nSwitchSmplNo;
  587. String strSmplMessage;
  588. strSmplMessage = pSample.GetName() + ":" + "\r\n";
  589. // is this a measurement completed sample
  590. if (IsMeasureCompletedSmpl(pSample))
  591. { // measurement completed sample
  592. ++nCompletedSmplNo;
  593. string str2 = GetSampleErrorWarnString(SAMPLE_FAULT_WARN_CODE.FINISHED);
  594. strSmplMessage += str2;
  595. strSmplMessage += "\r\n";
  596. }
  597. else
  598. {
  599. // errors
  600. List<SAMPLE_FAULT_WARN_CODE> a_listErrorCodes = new List<SAMPLE_FAULT_WARN_CODE>();
  601. GetSampleErrorCodes(a_pProjMgrFile, pSample, ref a_listErrorCodes);
  602. if (a_listErrorCodes.Count != 0)
  603. {
  604. // has error, this is not a measurable sample
  605. ++nErrorSmplNo;
  606. foreach (var nErrorCode in a_listErrorCodes)
  607. {
  608. String str3 = GetSampleErrorWarnString(nErrorCode);
  609. strSmplMessage += str3;
  610. strSmplMessage += "\r\n";
  611. }
  612. }
  613. else
  614. {
  615. // no error, this is a measurable sample
  616. listMeasurableSamples.Add(pSample);
  617. }
  618. // warnings
  619. List<SAMPLE_FAULT_WARN_CODE> a_listWarningCodes = new List<SAMPLE_FAULT_WARN_CODE>();
  620. GetSampleWarningCodes(a_pProjMgrFile, pSample, ref a_listWarningCodes);
  621. if (a_listWarningCodes.Count != 0)
  622. {
  623. ++nWarningSmplNo;
  624. foreach (var nWarningCode in a_listWarningCodes)
  625. {
  626. String str3 = GetSampleErrorWarnString(nWarningCode);
  627. strSmplMessage += str3;
  628. strSmplMessage += "\r\n";
  629. }
  630. // has no error?
  631. if (a_listErrorCodes.Count == 0)
  632. {
  633. // this is a measurable sample but with setting warnings
  634. listWithWarningMeasurableSamples.Add(pSample);
  635. }
  636. }
  637. // no error and warning
  638. if (a_listErrorCodes.Count == 0 && a_listWarningCodes.Count == 0)
  639. {
  640. String str3 = GetSampleErrorWarnString(SAMPLE_FAULT_WARN_CODE.NO_ERROR_WARNING);
  641. strSmplMessage += str3;
  642. strSmplMessage += "\r\n";
  643. }
  644. }
  645. // add
  646. listSamplMessages.Add(strSmplMessage);
  647. }
  648. }
  649. // dlg message string
  650. String strDlgMessage = "";
  651. String str;
  652. String str1;
  653. str1 = GetResourceByKey(GrpOtherParam, IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.SWITCH_ON);
  654. str1 = str1.Replace("%d", "{0}");
  655. str = string.Format(str1, nSwitchSmplNo);
  656. strDlgMessage += str;
  657. strDlgMessage += "\r\n";
  658. // add more string if there switch on sample
  659. if (nSwitchSmplNo > 0)
  660. {
  661. // completed sample number (optional)
  662. if (nCompletedSmplNo > 0)
  663. {
  664. str1 = GetResourceByKey(GrpOtherParam, IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.FINISHED);
  665. str1 = str1.Replace("%d", "{0}");
  666. str = string.Format(str1, nCompletedSmplNo);
  667. strDlgMessage += str;
  668. strDlgMessage += "\r\n";
  669. }
  670. // any unmeasured switch on samples?
  671. if (nSwitchSmplNo > nCompletedSmplNo)
  672. {
  673. // with setting error sample number
  674. str1 = GetResourceByKey(GrpOtherParam, IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.SETTING_ERROR);
  675. str1 = str1.Replace("%d", "{0}");
  676. str = string.Format(str1, nErrorSmplNo);
  677. strDlgMessage += str;
  678. strDlgMessage += "\r\n";
  679. // with setting warning sample number
  680. str1 = GetResourceByKey(GrpOtherParam, IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.SETTING_WARNING);
  681. str1 = str1.Replace("%d", "{0}");
  682. str = string.Format(str1, nWarningSmplNo);
  683. strDlgMessage += str;
  684. strDlgMessage += "\r\n";
  685. }
  686. }
  687. // add an empty line strDlgMessage
  688. strDlgMessage += "\r\n";
  689. // add sample messages
  690. foreach (var strSmplMessage in listSamplMessages)
  691. {
  692. strDlgMessage += strSmplMessage;
  693. strDlgMessage += "\r\n";
  694. }
  695. // do we need to show dialog box?
  696. if (nSwitchSmplNo == 0)
  697. {
  698. return false;
  699. }
  700. // measure button clicked?
  701. if (a_bCheckSetting)
  702. {
  703. // there are measurable samples but no setting warnings samples
  704. if (listMeasurableSamples.Count > 0 && listWithWarningMeasurableSamples.Count == 0)
  705. {
  706. // set output measurable samples list
  707. foreach (var pSample in listMeasurableSamples)
  708. {
  709. a_listMeasuableSamples.Add(pSample);
  710. }
  711. return true;
  712. }
  713. }
  714. //when there is sample setting error, and setting with no error and no warning samples, the dlg will not be show.??
  715. //show the result dlg
  716. DIALOG_CHECK_PARAM_RESULT dlg = new DIALOG_CHECK_PARAM_RESULT();
  717. int nTatolMeasuableSmplNo = listMeasurableSamples.Count;
  718. int nWithWarningMeasuableSmplNo = listWithWarningMeasurableSamples.Count;
  719. // set the dlg parameters
  720. dlg.SetCheckOnlyFlag(a_bCheckSetting);
  721. dlg.SetMessageBase(strDlgMessage);
  722. dlg.SetTatolMeasuableSmplNo(nTatolMeasuableSmplNo);
  723. dlg.SetWithWarningMeasuableSmplNo(nWithWarningMeasuableSmplNo);
  724. //no error not show dlg
  725. if (nTatolMeasuableSmplNo == nSwitchSmplNo - nCompletedSmplNo && listMeasurableSamples.Count != 0)
  726. {
  727. foreach (var pSample in listMeasurableSamples)
  728. {
  729. var itr = listWithWarningMeasurableSamples.Find(s => { return s.GetName() == pSample.GetName(); });
  730. if (itr == null)
  731. {
  732. a_listMeasuableSamples.Add(pSample);
  733. }
  734. }
  735. if (a_listMeasuableSamples.Count == listMeasurableSamples.Count)
  736. {
  737. return true;
  738. }
  739. }
  740. //show dlg
  741. DialogResult dResult = dlg.ShowDialog();
  742. if (!(dResult == System.Windows.Forms.DialogResult.OK))
  743. {
  744. // do something here
  745. return false;
  746. }
  747. else
  748. {
  749. //if warnDo, back the listMeasuableSample
  750. if (dlg.GetWarnDo())
  751. {
  752. foreach (var pSample in listMeasurableSamples)
  753. {
  754. a_listMeasuableSamples.Add(pSample);
  755. }
  756. }
  757. else // back with no warn sample
  758. {
  759. foreach (var pSample in listMeasurableSamples)
  760. {
  761. var itr = listWithWarningMeasurableSamples.Find(e => { return e.GetName() == pSample.GetName(); });
  762. if (itr == null)
  763. {
  764. a_listMeasuableSamples.Add(pSample);
  765. }
  766. }
  767. }
  768. }
  769. return true;
  770. }
  771. bool IsMeasureCompletedSmpl(COTSSample a_pSample)
  772. {
  773. // safety check
  774. if (a_pSample.GetMsrStatus().GetStatus() != OTSDataType.OTS_MSR_SAMPLE_STATUS.SUCCESSED)
  775. {
  776. return false;
  777. }
  778. return true;
  779. }
  780. string GetSampleErrorWarnString(SAMPLE_FAULT_WARN_CODE a_nSampleFaultWarn)
  781. {
  782. // check input
  783. if (a_nSampleFaultWarn < SAMPLE_FAULT_WARN_CODE.MIN && a_nSampleFaultWarn > SAMPLE_FAULT_WARN_CODE.MAX)
  784. {
  785. return "";
  786. }
  787. // error/waring string
  788. string strErrorWarn;
  789. strErrorWarn = GetResourceByKey(GrpOtherParam, IDS_ERROR_WARNING + (int)a_nSampleFaultWarn);
  790. return strErrorWarn;
  791. }
  792. // get error codes list of a sample
  793. void GetSampleErrorCodes(COTSMsrPrjResultData a_pProjMgrFile, COTSSample a_pSample, ref List<SAMPLE_FAULT_WARN_CODE> a_listErrorCodes)
  794. {
  795. const string UNTITLED_FILE_NAME = "Untitled";
  796. // file has not been saved
  797. String strPathName = a_pProjMgrFile.GetPathName();
  798. // is this a file no saved?
  799. strPathName.Trim();
  800. if (strPathName == UNTITLED_FILE_NAME || strPathName == "")
  801. {
  802. a_listErrorCodes.Add(SAMPLE_FAULT_WARN_CODE.FILE_NOT_SAVED);
  803. }
  804. }
  805. // get warning codes list of a sample
  806. void GetSampleWarningCodes(COTSMsrPrjResultData a_pProjMgrFile, COTSSample a_pSample, ref List<SAMPLE_FAULT_WARN_CODE> a_listWarningCodes)
  807. {
  808. // get the work stage
  809. CStage pStage = a_pProjMgrFile.GetStage();
  810. //get hole
  811. String sHoleName = a_pSample.GetSampleHoleName();
  812. //look for the hole Domain
  813. CHole pSampleHole = pStage.GetHoleByName(sHoleName);
  814. if (pSampleHole == null)
  815. {
  816. return;
  817. }
  818. if (a_pSample.GetSEMDataMsr() != null)
  819. {
  820. // compute pixel size
  821. double dPixleSize = a_pSample.CalculatePixelSize();
  822. // get min size
  823. COTSImageProcParam pImageProcParam = a_pSample.GetMsrParams().GetImageProcessParam();
  824. double dMinSize = pImageProcParam.GetIncAreaRange().GetStart();
  825. // if pixel size is bigger than 1/2 of the min size,than can't see the object clearly on current magnification
  826. if (dPixleSize >= dMinSize * 0.5)
  827. {
  828. // resolution low
  829. a_listWarningCodes.Add(SAMPLE_FAULT_WARN_CODE.RESOLUTION_LOW);
  830. }
  831. }
  832. if(a_pSample.GetSEMDataMsr().GetTotalFields()==0
  833. && a_pSample.GetSEMDataMsr().GetScanFieldSize() == 0
  834. && a_pSample.GetSEMDataMsr().GetWorkingDistance() == 0)
  835. {
  836. // SEM_DATA_ERROR
  837. a_listWarningCodes.Add(SAMPLE_FAULT_WARN_CODE.SEM_DATA_ERROR);
  838. }
  839. }
  840. //public bool SaveWorkMeasureFile()
  841. //{
  842. // CSampleParamMgr SMeasureParamData = new CSampleParamMgr();
  843. // COTSSample WSample = GetResultData().GetWorkingSample();
  844. // if (null == WSample)
  845. // {
  846. // return false;
  847. // }
  848. // if (!SMeasureParamData.SetMsrParamFile(WSample.GetMsrParams()))
  849. // {
  850. // return false;
  851. // }
  852. // // file open dialog
  853. // CSampleParamMgr cSampleParamMgr = new CSampleParamMgr();
  854. // SaveFileDialog saveFileDialog = new SaveFileDialog();
  855. // saveFileDialog.FileName = WSample.GetName() +"_Config"+ cSampleParamMgr.MESUREMENT_PARAM_FILE_EXT;
  856. // saveFileDialog.Filter = cSampleParamMgr.MESUREMENT_PARAM_FILE_FILTER;
  857. // if (saveFileDialog.ShowDialog() != DialogResult.OK)
  858. // {
  859. // return false;
  860. // }
  861. // // get file pathname
  862. // string strPathName = saveFileDialog.FileName;
  863. // SMeasureParamData.Save(strPathName);
  864. // return true;
  865. //}
  866. //打开工作样品的测量参数文件
  867. public bool LoadWorkMeasureFile()
  868. {
  869. CSampleParamMgr SMeasureParamData = new CSampleParamMgr();
  870. OpenFileDialog openFileDialog = new OpenFileDialog();
  871. openFileDialog.Filter = SMeasureParamData.MESUREMENT_PARAM_FILE_FILTER;
  872. if (openFileDialog.ShowDialog() != DialogResult.OK)
  873. {
  874. return false;
  875. }
  876. // get file pathname
  877. string strPathName = openFileDialog.FileName;
  878. if (!SMeasureParamData.Load(strPathName, true))
  879. {
  880. return false;
  881. }
  882. COTSSample WSample = GetResultData().GetWorkingSample();
  883. if (null == WSample)
  884. {
  885. return false;
  886. }
  887. WSample.SetMsrParams(SMeasureParamData.GetMsrParams());
  888. //更新样品GRID值测量文件名
  889. OTSSampleVisualPropertyInfo SMInfo = new OTSSampleVisualPropertyInfo(WSample,defaultParam.GetSysType());
  890. m_MeasureAppFrom.m_SPropertyWindows.DisplaySampleMeasureInfo(SMInfo);
  891. return true;
  892. }
  893. //判断是否允许修改样品名
  894. public bool CheckSampleNameIsValid(string sNewName)
  895. {
  896. return GetResultData().IsValidSampleName(sNewName);
  897. }
  898. //设置电镜参数
  899. //int iScanFieldSize: Field扫描参数
  900. //int iWDistance: 电镜工作距离
  901. //double dMagni: 放大倍数
  902. public void SetWorkingSampleSEMData(double iWDistance, double dMagni)
  903. {
  904. GetResultData().GetWorkingSample().GetSEMDataMsr().SetWorkingDistance(iWDistance);
  905. GetResultData().GetWorkingSample().GetSEMDataMsr().SetMagnification(dMagni);
  906. }
  907. //public void SetFliedsCount(int FliedsCount)
  908. //{
  909. // GetResultData().GetWorkingSample().GetSEMDataMsr().SetTotalFields(FliedsCount);
  910. //}
  911. public void GetWorkingSampleSEMData(ref double iWDistance, ref double dMagni)
  912. {
  913. iWDistance = GetResultData().GetWorkingSample().GetSEMDataMsr().GetWorkingDistance();
  914. dMagni = GetResultData().GetWorkingSample().GetSEMDataMsr().GetMagnification();
  915. }
  916. //public int GetTotalFieldsCount()
  917. //{
  918. // int icount = GetResultData().GetWorkingSample().GetSEMDataMsr().GetTotalFields();
  919. // return icount;
  920. //}
  921. //获取工作样品的测量区域
  922. //int iShape :测量区域形状
  923. //Rectangle Srect: 测量区域大小
  924. //public bool GetWorkSampleMrsArea(ref int iShape, ref RectangleF Srect)
  925. //{
  926. // COTSSample WSample = GetResultData().GetWorkingSample();
  927. // if (null == WSample)
  928. // {
  929. // return false;
  930. // }
  931. // CDomain pMsrArea = new CDomain();
  932. // pMsrArea = WSample.GetMsrDomain();
  933. // if (null == pMsrArea)
  934. // {
  935. // return false;
  936. // }
  937. // iShape = (int)pMsrArea.GetShape();
  938. // Srect = pMsrArea.GetRectDomain();
  939. // return true;
  940. //}
  941. //检查Samplelist中的sample的checkbox状态
  942. //当Samplelist中的链表有sample 的checkbox状态是选中状态,则返回TRUE. 说明可以测量
  943. public bool GetSampleCheckBoxStatus()
  944. {
  945. COTSSample WSample = GetResultData().GetWorkingSample();
  946. if (null == WSample)
  947. {
  948. return false;
  949. }
  950. List<COTSSample> SampleList = new List<COTSSample>();
  951. SampleList = GetResultData().GetSampleList();
  952. int iCount = SampleList.Count();
  953. if (0 == iCount)
  954. {
  955. return false;
  956. }
  957. for (int i = 0; i < iCount; i++)
  958. {
  959. if (SampleList[i].GetSwitch())
  960. {
  961. return true;
  962. }
  963. }
  964. return false;
  965. }
  966. //获取BSE图像数据
  967. public bool GetBSEImageSize(ref int iHeight, ref int iWidth)
  968. {
  969. COTSSample WSample = GetResultData().GetWorkingSample();
  970. if (null == WSample)
  971. {
  972. return false;
  973. }
  974. if (!WSample.GetBSESize(out iHeight, out iWidth))
  975. {
  976. return false;
  977. }
  978. return true;
  979. }
  980. //获取图像尺寸
  981. public string GetBSEImageResolutionStr()
  982. {
  983. try
  984. {
  985. COTSSample WSample = GetResultData().GetWorkingSample();
  986. var res= WSample.GetMsrParams().GetImageScanParam().GetImageResolutionSize();
  987. return res.cx+"X"+res.cy;
  988. }
  989. catch (Exception)
  990. {
  991. return "";
  992. }
  993. }
  994. //获取放大倍数和工作距离
  995. public bool GetMagAndDistance(ref double SemMag, ref double dDistance)
  996. {
  997. COTSSample WSample = GetResultData().GetWorkingSample();
  998. if (null == WSample)
  999. {
  1000. return false;
  1001. }
  1002. GetWorkingSampleSEMData(ref dDistance, ref SemMag);
  1003. return true;
  1004. }
  1005. //保存测量样品的
  1006. //public bool SaveMeasureSampleInfo()
  1007. //{
  1008. // if (!GetResultData().Save())
  1009. // {
  1010. // return false;
  1011. // }
  1012. // return true;
  1013. //}
  1014. //获取测量Sample的开始时间
  1015. public bool GetMsrSampleStartTime(ref DateTime MsrFieldStartTime)
  1016. {
  1017. COTSSample WSample = GetResultData().GetWorkingSample();
  1018. if (null == WSample)
  1019. {
  1020. return false;
  1021. }
  1022. MsrFieldStartTime = (DateTime)WSample.GetMsrStatus().GetStartTime();
  1023. return true;
  1024. }
  1025. //获取测量已用时间
  1026. public bool GetMsrSampleUsedTime(ref TimeSpan TUsedTime)
  1027. {
  1028. COTSSample WSample = GetResultData().GetWorkingSample();
  1029. if (null == WSample)
  1030. {
  1031. return false;
  1032. }
  1033. TUsedTime = (TimeSpan)WSample.GetMsrStatus().GetUsedTime();
  1034. return true;
  1035. }
  1036. // 获取测量样品中之前已经测量完成Field帧图,(上一次未测量完成继续测试)
  1037. public bool GetBeforeCompleteField(ref string MsrSampleName, ref List<PointF> FieldList)
  1038. {
  1039. COTSSample WSample = GetResultData().GetWorkingSample();
  1040. if (null == WSample)
  1041. {
  1042. return false;
  1043. }
  1044. MsrSampleName = WSample.GetName();
  1045. FieldList = WSample.GetMsrStatus().GetCompletedFieldsCenter();
  1046. return true;
  1047. }
  1048. /// <summary>
  1049. /// 通过样品孔信息 返回默认测量区域大小
  1050. /// </summary>
  1051. /// <param name="cHoleClr"></param>
  1052. /// <returns></returns>
  1053. public RectangleF CalculateMsrArea(string cHoleName)
  1054. {
  1055. CHole cHoleClr = null;
  1056. foreach (CHole item in GetResultData().GetStage().GetHoleList())
  1057. {
  1058. if (item.GetName() == cHoleName)
  1059. {
  1060. cHoleClr = item;
  1061. }
  1062. }
  1063. CDomain CDomain = GetResultData().CalculateMsrArea(cHoleClr);
  1064. return CDomain.GetRectDomain();
  1065. }
  1066. /// <summary>
  1067. /// 获取已完成测量的结果文件路径
  1068. /// </summary>
  1069. /// <param name="mrFilePathList">返回测量结果文件路径</param>
  1070. /// <returns></returns>
  1071. public bool GetCompletedMeasureFileName(ref List<string> mrFilePathList)
  1072. {
  1073. //测量文件路径
  1074. string proFilePath = GetResultData().GetPathName();
  1075. //样品列表
  1076. List<COTSSample> sampleList = GetResultData().GetSampleList();
  1077. //获取样品数量
  1078. int sampleCount = sampleList.Count;
  1079. string mrSuffix = ".rst";
  1080. int existsCount = 0;
  1081. //获取测量文件路径
  1082. if (proFilePath.Equals("Untitled"))
  1083. {
  1084. return false;
  1085. }
  1086. string mrFolderPath = string.Empty;
  1087. try
  1088. {
  1089. mrFolderPath = proFilePath.Substring(0, proFilePath.LastIndexOf("\\"));
  1090. }
  1091. catch (Exception)
  1092. {
  1093. mrFolderPath = string.Empty;
  1094. }
  1095. for (int sampleIndex = 0; sampleIndex < sampleCount; sampleIndex++)
  1096. {
  1097. int CompleteFieldsCount = sampleList[sampleIndex].GetMsrStatus().GetCompletedFields();
  1098. //如果样品已测量成功后再加载至报告程序中
  1099. if (CompleteFieldsCount > 0)
  1100. {
  1101. string sampleName = sampleList[sampleIndex].GetName();
  1102. string mrFilePath = mrFolderPath + "\\" + sampleName + "\\" + sampleName + mrSuffix;
  1103. //判断文件是否存在
  1104. if (File.Exists(mrFilePath))
  1105. {
  1106. if (mrFilePathList != null)
  1107. {
  1108. mrFilePathList.Add(mrFilePath);
  1109. }
  1110. existsCount++;
  1111. }
  1112. }
  1113. }
  1114. if (existsCount > 0)
  1115. {
  1116. return true;
  1117. }
  1118. return false;
  1119. }
  1120. /// <summary>
  1121. /// 获取工作样品的测量状态
  1122. /// </summary>
  1123. /// <param name="workingSampleName"></param>
  1124. /// <returns></returns>
  1125. public bool GetWorkSampleMeasureStatus()
  1126. {
  1127. bool reuslt = false;
  1128. COTSSample COTSSample = GetResultData().GetWorkingSample();
  1129. if (COTSSample == null) return false;
  1130. int sampleStatus = COTSSample.GetMsrStatus().GetCompletedFields();
  1131. if (sampleStatus > 0)
  1132. {
  1133. reuslt = true;
  1134. }
  1135. return reuslt;
  1136. }
  1137. }
  1138. }