/// <summary> /// 单芯查询 无 IN条件 /// </summary> /// <param name="e"></param> public void GetData_Method_OneCore(My_GetTestData.GetDataEventArgs e) { //查询JDSU中的数据 string sql = " SELECT LEFT(SN, 10) AS SN, '1' AS Name, Result, Wave, IL_A, Refl_A, IL_B, Refl_B, TestDate "; sql += " FROM User_JDS_Test_Good"; sql += " WHERE " + e.sqlWhere + " AND (Result LIKE '%Passed')"; e.TestData = dbs.Query(sql); //返回查询到的数据 //查询Exfo中的数据 bool tem = false; if (e.TestData.Tables[0].Rows.Count > 0) { tem = false; } else { tem = true; } if (tem) { string asql = "SELECT * FROM( SELECT LEFT (dbo.TDUTMeasurement.Dum_FixSerialNr,10) AS [SN], "; asql += " '1' AS [Name], "; asql += "(CASE WHEN dbo.TDUTMeasurement.Dum_GlobalTestStatus = 1 THEN 'PASS' END ) AS [Result] , "; asql += " (CASE WHEN dbo.TWaveLength.Wvl_Value = 0.0000013100 THEN '1310nm' WHEN dbo.TWaveLength.Wvl_Value = 0.0000015500 THEN '1550um' END ) AS Wave, "; asql += "dbo.TFiberMeasurement.Fim_ILEndA AS [Il_A], "; asql += "dbo.TFiberMeasurement.Fim_ReflectanceEndA AS [Refl_A], "; asql += "dbo.TFiberMeasurement.Fim_ILEndB AS [Il_B], "; asql += "dbo.TFiberMeasurement.Fim_ReflectanceEndB AS [Refl_B], "; asql += "dbo.TDUTMeasurement.Dum_MeasurementDate AS [TestDate] "; asql += " FROM dbo.TDUTMeasurement LEFT OUTER JOIN"; asql += " dbo.TTestTemplate ON "; asql += " dbo.TDUTMeasurement.Dum_Tst_Id = dbo.TTestTemplate.Tst_Id LEFT OUTER JOIN"; asql += " dbo.TFiberMeasurement ON"; asql += " dbo.TFiberMeasurement.Fim_Dum_Id = dbo.TDUTMeasurement.Dum_Id LEFT OUTER JOIN"; asql += " dbo.TCustomer ON "; asql += " dbo.TTestTemplate.Tst_Cus_Id = dbo.TCustomer.Cus_Id LEFT OUTER JOIN"; asql += " dbo.TDutModel ON "; asql += " dbo.TTestTemplate.Tst_Dtm_Id = dbo.TDutModel.Dtm_Id LEFT OUTER JOIN"; asql += " dbo.TCable ON dbo.TCable.Cab_Dtm_Id = dbo.TDutModel.Dtm_Id LEFT OUTER JOIN"; asql += " dbo.TFiber ON dbo.TFiber.Fib_Cab_Id = dbo.TCable.Cab_Id LEFT OUTER JOIN"; asql += " dbo.TConnector AS StartingConnector ON "; asql += " dbo.TFiber.Fib_Starting_Con_Id = StartingConnector.Con_Id LEFT OUTER JOIN"; asql += " dbo.TWaveLength ON"; asql += " dbo.TFiberMeasurement.Fim_Wvl_Id = dbo.TWaveLength.Wvl_Id"; asql += " WHERE (dbo.TDUTMeasurement.Dum_FixSerialNr LIKE '" + e.SN + "%') AND (TDUTMeasurement.Dum_GlobalTestStatus = '1')) AS TemTab"; asql += " WHERE " + e.sqlWhere + " AND (Result LIKE '%Passed')"; e.TestData = dbs_Exfo.Query(asql); } if (e.TestData.Tables[0].Rows.Count > 0) { ArrayList temAl = new ArrayList(); temAl.Add("1"); e.PigtailList = temAl; } // e.PiagtilNum = e.TestData.Tables[0].Rows[0][""].ToString(); }
/// <summary> /// 获取 MPO JDS数据 /// </summary> public void GetData_MPO(My_GetTestData.GetDataEventArgs e) { //查询JDSU中的数据 string sql = " SELECT LEFT(SN, 13) AS SN, SUBSTRING(SN, 15, 2) AS Name, Result, Wave, IL_A, ABS(Refl_A) AS Refl_A, IL_B, Refl_B, TestDate "; sql += " FROM User_JDS_Test_Good"; sql += " WHERE " + e.sqlWhere + " AND (Result LIKE '%Passed')"; e.TestData = dbs.Query(sql); e.PigtailList = Get_PigtailList(e.TestData, 11); //查询Exfo中的数据 bool tem = false; if (e.TestData.Tables[0].Rows.Count > 0) { tem = false; } else { tem = true; } //如果JDS表中没有数据 从Exfo测试表中查找 if (tem) { string asql = " SELECT * FROM (SELECT CAST(TDUTMeasurement.Dum_FixSerialNr AS nvarchar(20)) "; asql += " + '-' + TDUTMeasurement.Dum_IncrSerialNr AS SN, TFiber.Fib_SequenceNr AS Name, "; asql += " (CASE WHEN dbo.TDUTMeasurement.Dum_GlobalTestStatus = 1 THEN 'PASS' END) AS Result, "; asql += " (CASE WHEN dbo.TWaveLength.Wvl_Value = 0.0000013100 THEN '1310nm' WHEN "; asql += " dbo.TWaveLength.Wvl_Value = 0.0000015500 THEN '1550nm' "; asql += " WHEN dbo.TWaveLength.Wvl_Value = 0.0000008500 THEN '850nm' WHEN dbo.TWaveLength.Wvl_Value = 0.0000013000 THEN '1300nm' END) "; asql += " AS Wave, TFiberMeasurement.Fim_ILEndA AS Il_A, "; asql += " TFiberMeasurement.Fim_ReflectanceEndA AS Refl_A, "; asql += " TFiberMeasurement.Fim_ILEndB AS Il_B, "; asql += " TFiberMeasurement.Fim_ReflectanceEndB AS Refl_B, "; asql += " TDUTMeasurement.Dum_MeasurementDate AS TestDate"; asql += " FROM TFiber INNER JOIN"; asql += " TFiberMeasurement ON "; asql += " TFiber.Fib_Id = TFiberMeasurement.Fim_Fib_Id RIGHT OUTER JOIN "; asql += " TDUTMeasurement ON "; asql += " TFiberMeasurement.Fim_Dum_Id = TDUTMeasurement.Dum_Id LEFT OUTER JOIN"; asql += " TWaveLength ON "; asql += " TFiberMeasurement.Fim_Wvl_Id = TWaveLength.Wvl_Id"; asql += " WHERE (TDUTMeasurement.Dum_FixSerialNr = '" + e.SN + "') AND "; asql += " (TDUTMeasurement.Dum_GlobalTestStatus = '1')) AS derivedtbl_1"; //赋值返回的测试数据 e.TestData = dbs_Exfo.Query(asql); e.PigtailList = Get_PigtailList(e.TestData, 11); } }
/// <summary> /// 双并查询 有IN条件 /// </summary> /// <param name="e"></param> public void Getdata_Method_TwainCore(My_GetTestData.GetDataEventArgs e) { string sql = " SELECT TOP (100) PERCENT LEFT(SN, 13) AS SN, SUBSTRING(SN, 12, 2) AS Name, Type, "; sql += " Result, Curvature, Curvature_Result, Spherical, Spherical_Result, Planar, "; sql += " Planar_Result, Apex_Offset, Apex_Offset_Result, Bearing, Bearing_Result, "; sql += " Apex_Angle, Apex_Angle_Result, Tilt_Offset, Tilt_Offset_Result, Tilt_Angle, "; sql += " Tilt_Angle_Result, KeyError, KeyError_Result, FiberRq, FiberRq_Result, FiberRa, "; sql += " FiberRa_Result, FerruleRq, FerruleRq_Result, FerruleRa, FerruleRa_Result, "; sql += " Diameter, Diameter_Result, Test_Date, Test_Time, D, E, F, A "; sql += " FROM User_3D_Test_Good "; sql += " WHERE " + e.sqlWhere + " AND (Result LIKE N'%PASS%') "; e.TestData = dbs.Query(sql); if (e.TestData.Tables[0].Rows.Count > 0) { e.PigtailList = GetPigtailList(e.TestData); } }