COTSMeasureParam.cs 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411
  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. }