public static List <PIMResult> setPIMResult(TestPlan testPlan, string SN, string strRemark, string Material, string ProcessId) { List <PIMResult> lstResult = new List <PIMResult>(); try { PIMResult result = new PIMResult(); result.SN = SN; result.ATEKind = "ATEPIM"; result.Material = (Material == null ? "" : Material); result.ProcessId = (ProcessId == null ? "" : ProcessId); result.TestUserID = (DataUtils.StaticInfo.LoginUser == null ? "" : DataUtils.StaticInfo.LoginUser); result.Remark = strRemark; result.SaveDateTime = DataUtils.StaticInfo.DBTime; int i = 0; string strDeviceModel = ""; foreach (ManualConnection manualConnection in testPlan.ManualConnectionList) { foreach (TestStep testStep in manualConnection.TestStepList) { PIMTestStep PTestStep = (PIMTestStep)testStep; if (PTestStep.MeasInfo != null) { strDeviceModel = strDeviceModel + ";" + PTestStep.MeasInfo.InstruInfoList[0].Vendor + "," + PTestStep.MeasInfo.InstruInfoList[0].Model + "," + PTestStep.MeasInfo.InstruInfoList[0].SerialNum; } StepData stepData = new StepData(); i++; stepData.STEPID = i.ToString(); stepData.ProName = manualConnection.Name; stepData.PortName = PTestStep.PortName.ToString(); stepData.Band = (PTestStep.FreqRange == null ? "" : PTestStep.FreqRange); //stepData.Band = ""; stepData.RBandMin = (PTestStep.RXFreq1 / 1000000).ToString("f3"); stepData.RBandMax = (PTestStep.RXFreq2 / 1000000).ToString("f3"); stepData.CalType = PTestStep.CalType.ToString(); stepData.MeasMode = PTestStep.MeasMode.ToString(); stepData.Order = PTestStep.PIMOrder.ToString(); stepData.Freq1 = (PTestStep.CWFreq1 / 1000000).ToString("f3"); stepData.Freq2 = (PTestStep.CWFreq2 / 1000000).ToString("f3"); stepData.Pow1 = PTestStep.CWPOW1.ToString("f2"); stepData.Pow2 = PTestStep.CWPOW2.ToString("f2"); stepData.IMPow1 = PTestStep.PIMPower1.ToString("f2"); stepData.IMPow2 = PTestStep.PIMPower2.ToString("f2"); foreach (PIMTestTrace tr in PTestStep.TraceList) { //BUG HHX if (tr.TypeName == PIMTestTraceType.PIMTrace1) { stepData.ResUnit = (tr.Unit == null ? "" : tr.Unit); XYTestMarker xyTestMarker = tr.TestSpecList[0].TestMarkerList[0] as XYTestMarker; stepData.Limit = xyTestMarker.Limit.YMax.ToString(); XYTraceResult traceRes = tr.TestResult as XYTraceResult; if (traceRes.ResultData == null || traceRes.ResultData.Count == 0) { stepData.ResultFim1 = "0"; stepData.ResultValue1 = "0"; } else { if (PTestStep.CalType == PIMCalType.Sweep) { stepData.ResultFim1 = (xyTestMarker.MarkerResult[0].X / 1000000).ToString("f3"); } else { int num = PTestStep.PIMOrder / 2; double dblIMF = (((num + 1) * PTestStep.CWFreq1) - (num * PTestStep.CWFreq2)); stepData.ResultFim1 = (dblIMF / 1000000).ToString("f3"); } stepData.ResultValue1 = xyTestMarker.MarkerResult[0].Y.ToString("f2"); } stepData.ResultFim2 = "0"; stepData.ResultValue2 = "0"; } if (tr.TypeName == PIMTestTraceType.PIMTrace2) { if (PTestStep.CalType == PIMCalType.Sweep) { XYTraceResult traceRes = tr.TestResult as XYTraceResult; if (traceRes.ResultData == null || traceRes.ResultData.Count == 0) { stepData.ResultFim2 = "0"; stepData.ResultValue2 = "0"; } else { XYTestMarker xyTestMarker = tr.TestSpecList[0].TestMarkerList[0] as XYTestMarker; stepData.ResultFim2 = (xyTestMarker.MarkerResult[0].X / 1000000).ToString("f3"); stepData.ResultValue2 = xyTestMarker.MarkerResult[0].Y.ToString("f2"); } } } } stepData.Result = (PTestStep.PassFail == true ? "PASS" : "FAIL"); stepData.TestDateTime = (PTestStep.SingleDBTime == null ? "" : PTestStep.SingleDBTime); stepData.isImage = PTestStep.isImageSave; stepData.Image = (PTestStep.bImage == null ? new byte[] { } : PTestStep.bImage); result.lstStepData.Add(stepData); } } string strResultForHead = "PASS"; foreach (ManualConnection manualConnection in testPlan.ManualConnectionList) { foreach (TestStep testStep in manualConnection.TestStepList) { PIMTestStep PTestStep = (PIMTestStep)testStep; if (PTestStep.PassFail == false || PTestStep.PassFail == null) { strResultForHead = "FAIL"; break; } } } result.ResultForHead = strResultForHead; result.DeviceModel = strDeviceModel; lstResult.Add(result); } catch (Exception ex) { //System.Windows.m } return(lstResult); }
public PIMTestTrace() { TypeName = PIMTestTraceType.PIMTrace1; TestResult = new XYTraceResult(); }