Example #1
0
        //试剂吸光度
        public static float GetReangentAbs(TimeCourseInfo TC, AssayProjectParamInfo AR)
        {
            float Abs1 = TC.CuvXWmList[0] - TC.CuvBlkWm;
            float Abs2 = TC.CuvXWsList[0] - TC.CuvBlkWs;

            return(AR.SecWaveLength == 0 ? Abs1 : Abs1 - Abs2);
        }
Example #2
0
        //底物吸光度
        public static float GetAbsLimAbs(TimeCourseInfo TC, AssayProjectParamInfo AR)
        {
            float WmAbs = TC.CuvXWmList[AR.MeasureLightDot4 - 1] - TC.CuvBlkWm;
            float WsAbs = TC.CuvXWsList[AR.MeasureLightDot4 - 1] - TC.CuvBlkWs;

            return(AR.SecWaveLength == 0 ? WmAbs : WmAbs - WsAbs);
        }
Example #3
0
 /// <summary>
 /// 根据试剂保存对应的生化项目参数信息
 /// </summary>
 /// <param name="a"></param>
 public void SaveRGSpendingAssayProjectInfo(AssayProjectParamInfo a)
 {
     try
     {
         string sql = string.Format(@"insert assayprojectparaminfotb(
             ProjectName,SampleType,AnalysisMethod,MeasureLightDot1,MeasureLightDot2,MeasureLightDot3,MeasureLightDot4,
             ResultUnit,MainWaveLength,SecWaveLength,InstrumentFactorA,InstrumentFactorB,ComStosteVol,ComSamVol,ComDilutionVol,
             DecStosteVol,DecSamVol,DecDilutionVol,IncStosteVol,IncSamVol,IncDilutionVol,
             DilutionType,FirstSlope,FirstSlopeHigh,ProLowestBound,LimitValue,ReactionDirection,Reagent1VolSettings,Reagent2VolSettings,
             CalibStosteVol,CalibSamVol,CalibDilutionVol,Stirring1Intensity,Stirring2Intensity,SerumCriticalMinimum,SerumCriticalMaximum,ReagentBlankMinimum,ReagentBlankMaximum)
         values('{0}','{1}','{2}',{3},{4},{5},{6},
             '{7}',{8},{9},{10},{11},{12},{13},{14},
             {15},{16},{17},{18},{19},{20},'{21}',
             {22},{23},{24},{25},'{26}',{27},{28},
             {29},{30},{31},'{32}','{33}',{34},{35},{36},{37})",
                                    a.ProjectName, a.SampleType, a.AnalysisMethod, a.MeasureLightDot1, a.MeasureLightDot2, a.MeasureLightDot3, a.MeasureLightDot4,
                                    a.ResultUnit, a.MainWaveLength, a.SecWaveLength, a.InstrumentFactorA, a.InstrumentFactorB, a.ComStosteVol, a.ComSamVol, a.ComDilutionVol,
                                    a.DecStosteVol, a.DecSamVol, a.DecDilutionVol, a.IncStosteVol, a.IncSamVol, a.IncDilutionVol,
                                    a.DilutionType, a.FirstSlope, a.FirstSlopeHigh, a.ProLowestBound, a.LimitValue, a.ReactionDirection, a.Reagent1VolSettings,
                                    a.Reagent2VolSettings, a.CalibStosteVol, a.CalibSamVol, a.CalibDilutionVol, a.Stirring1Intensity, a.Stirring2Intensity,
                                    a.SerumCriticalMinimum, a.SerumCriticalMaximum, a.ReagentBlankMinimum, a.ReagentBlankMaximum);
         ism_SqlMap.Insert("AssayProjectInfo.SaveRGSpendingAssayProjectInfo", sql);
     }
     catch (Exception ex)
     {
         LogInfo.WriteErrorLog("SaveAssayProjectInfo(AssayProjectParamInfo a) == " + ex.Message, Module.LISSetting);
     }
 }
Example #4
0
        //获取前驱界限
        public static float GetProzontLimitValue(TimeCourseInfo T, AssayProjectParamInfo A, string VT, string VS)
        {
            float[] AbsList = ProcessAbsList(T, A, VT);
            float   max     = AbsList[0];

            for (int i = 0; i < AbsList.Count(); i++)
            {
                if (max < AbsList[i])
                {
                    max = AbsList[i];
                }
            }
            if (max > -0.000001 && max < 0.000001)
            {
                return(0.0f);
            }

            float sum = 0; int p = 0;

            for (int i = RunConfigureUtility.R2Point; i < RunConfigureUtility.BlankPoint; i++)
            {
                sum += RunConfigureUtility.PTInterval[i];
                if (sum > 150)
                {
                    p = i;
                    break;
                }
            }

            return(AbsList[p - 1] / max);
        }
Example #5
0
        public float GetResultAbsValue(ResultInfo samResultInfo)
        {
            float abs = 0;

            AssayProjectParamInfo para = myBatis.GetAssayProjectParamInfoByNameAndType("GetAssayProjectParamInfoByNameAndType", new AssayProjectInfo()
            {
                ProjectName = samResultInfo.ProjectName, SampleType = samResultInfo.SampleType
            });
            TimeCourseInfo tc           = myBatis.GetTimeCourse(samResultInfo.TCNO, samResultInfo.SampleCreateTime);
            string         dilutionType = "";

            if (samResultInfo.GetType().Name == "SampleResultInfo")
            {
                dilutionType = myBatis.GetSampleTaskDilutionType(samResultInfo as SampleResultInfo);
            }
            else
            {
                dilutionType = "常规体积";
            }
            //SampleInfo s = myBatis.GetSample(samResultInfo.SampleNum, samResultInfo.SampleCreateTime);

            // string SMPVOLTypeStr = null;
            //if (s != null)
            //{
            //    SMPType smptype = new SMPTypeService().Get(s.SampleType) as SMPType;
            //    if (smptype != null)
            //    {
            //        SMPVOLTypeStr = smptype.SMPVOLType;
            //    }
            //    else
            //    {
            //        SMPVOLTypeStr = "S";
            //    }
            //}

            if (para != null)
            {
                switch (para.AnalysisMethod)
                {
                case "一点终点法":
                    abs = ABSProcess.OnePoint(tc, para, dilutionType);
                    break;

                case "二点终点法":
                    abs = ABSProcess.TwoPoint(tc, para, dilutionType);
                    break;

                case "速率A法":
                    abs = ABSProcess.RateA(tc, para, dilutionType);
                    break;

                case "速率B法":
                    abs = ABSProcess.RateB(tc, para, dilutionType);
                    break;
                }
            }

            return(abs);
        }
Example #6
0
        //速A法
        public static float RateA(TimeCourseInfo TC, AssayProjectParamInfo AR, string VolType)
        {
            float[] AbsList  = null;
            float[] TimeList = null;
            ProcessAbsLinear(TC, AR, out AbsList, out TimeList, VolType);

            return(RateProcessC(AbsList, TimeList, AR.MeasureLightDot3, AR.MeasureLightDot4));
        }
Example #7
0
        //建立吸光度与时间关系
        public static void ProcessAbsLinear(TimeCourseInfo T, AssayProjectParamInfo A, out float[] AbsList, out float[] TimeList, string VT)
        {
            AbsList  = ProcessAbsList(T, A, VT);
            TimeList = new float[AbsList.Count()];

            for (int i = 0; i < AbsList.Count(); i++)
            {
                TimeList[i] = RunConfigureUtility.GetTimeCourseTime(i) / 60;
            }
        }
Example #8
0
        //一点法
        public static float OnePoint(TimeCourseInfo TC, AssayProjectParamInfo AR, string VolType)
        {
            float[] AbsList  = null;
            float[] TimeList = null;
            ProcessAbsLinear(TC, AR, out AbsList, out TimeList, VolType);
            float Sum = 0;

            for (int i = AR.MeasureLightDot3; i <= AR.MeasureLightDot4; i++)
            {
                Sum += AbsList[i - 1];
            }
            return(Sum / (AR.MeasureLightDot4 - AR.MeasureLightDot3 + 1));
        }
Example #9
0
        private void GridReviewProjectControl_Click(object sender, EventArgs e)
        {
            if (gridView1.GetFocusedDataRow() == null)
            {
                return;
            }
            SplitContainer splitContainer = new SplitContainer();

            splitContainer.BackColor = Color.Black;
            TxtBoxSampNumber.Text    = gridView1.GetFocusedRowCellValue("样本编号").ToString();
            TxtBoxCheckProject.Text  = gridView1.GetFocusedRowCellValue("检测项目").ToString();
            TxtBoxSampPos.Text       = gridView1.GetFocusedRowCellValue("样本位置").ToString();
            TxtSampleType.Text       = samplePatientInfo.SampleType;
            IProjectParam         param      = new ProjectParam();
            AssayProjectParamInfo assayParam = param.GetProjectParamInfoByNameOfType(TxtBoxCheckProject.Text, TxtSampleType.Text);

            TextNorOriginalVol.Text    = assayParam.ComStosteVol.ToString();
            TextNorSamDilutionVol.Text = assayParam.ComSamVol.ToString();
            TextNorDilutionVol.Text    = assayParam.ComDilutionVol.ToString();

            TextIncOriginalVol.Text    = assayParam.IncStosteVol.ToString();
            TextIncSamDilutionVol.Text = assayParam.IncSamVol.ToString();
            TextIncDilutionVol.Text    = assayParam.IncDilutionVol.ToString();

            TextDecOriginalVol.Text    = assayParam.DecStosteVol.ToString();
            TextDecSamDilutionVol.Text = assayParam.DecSamVol.ToString();
            TextDecDilutionVol.Text    = assayParam.DecDilutionVol.ToString();
            string reviewResult = gridView1.GetFocusedRowCellValue("复查原因").ToString();

            this.IsCheBoxDilution.Checked = false;
            if (reviewResult == "")
            {
                CheBoxNormal.CheckState         = CheckState.Checked;
                this.CheBoxIncrement.CheckState = CheckState.Unchecked;
                this.CheBoxDecrement.CheckState = CheckState.Unchecked;
            }
            else if (reviewResult == "浓度结果超出界限范围参数最大值")
            {
                this.CheBoxNormal.CheckState    = CheckState.Unchecked;
                this.CheBoxIncrement.CheckState = CheckState.Unchecked;
                this.CheBoxDecrement.CheckState = CheckState.Checked;
            }
            else if (reviewResult == "浓度结果低于界限范围参数最小值")
            {
                this.CheBoxNormal.CheckState    = CheckState.Unchecked;
                this.CheBoxIncrement.CheckState = CheckState.Checked;
                this.CheBoxDecrement.CheckState = CheckState.Unchecked;
            }
        }
Example #10
0
        public static void TimeCourseLineFit(TimeCourseInfo TC, AssayProjectParamInfo AR, out float K1, out float B1, out float R1, out float K2, out float B2, out float R2)
        {
            K1 = 0;
            B1 = 0;
            R1 = 0;
            K2 = 0;
            B2 = 0;
            R2 = 0;
            if (AR == null || TC == null)
            {
                return;
            }
            if (AR.MeasureLightDot4 == 0 && AR.MeasureLightDot3 == 0)
            {
                return;
            }

            float[] AbsList  = null;
            float[] TimeList = null;
            ProcessAbsLinear(TC, AR, out AbsList, out TimeList, null);

            float[] X2 = new float[AR.MeasureLightDot4 - AR.MeasureLightDot3 + 1];
            float[] Y2 = new float[AR.MeasureLightDot4 - AR.MeasureLightDot3 + 1];
            for (int j = 0, i = AR.MeasureLightDot3; i <= AR.MeasureLightDot4; j++, i++)
            {
                X2[j] = TimeList[i - 1];
                Y2[j] = AbsList[i - 1];
            }

            Least_Squaresstraight_LineFit(X2, Y2, out K2, out B2, out R2);


            if (AR.MeasureLightDot4 == 0 && AR.MeasureLightDot3 == 0)
            {
                return;
            }

            float[] X1 = new float[AR.MeasureLightDot2 - AR.MeasureLightDot1 + 1];
            float[] Y1 = new float[AR.MeasureLightDot2 - AR.MeasureLightDot1 + 1];
            for (int j = 0, i = AR.MeasureLightDot1; i <= AR.MeasureLightDot2; j++, i++)
            {
                X1[j] = TimeList[i - 1];
                Y1[j] = AbsList[i - 1];
            }

            Least_Squaresstraight_LineFit(X1, Y1, out K1, out B1, out R1);
        }
Example #11
0
        /// <summary>
        /// 获取生化项目参数信息
        /// </summary>
        /// <param name="projectName"></param>
        /// <param name="samplType"></param>
        /// <returns></returns>
        public AssayProjectParamInfo GetAssayProjectParamInfo(string projectName, string samplType)
        {
            AssayProjectParamInfo assayProjectParamInfo = null;

            try
            {
                assayProjectParamInfo = ism_SqlMap.QueryForObject("AssayProjectInfo.GetAssayProjectParamInfoByNameAndType", new AssayProjectParamInfo()
                {
                    ProjectName = projectName, SampleType = samplType
                }) as AssayProjectParamInfo;
            }
            catch (Exception ex)
            {
                LogInfo.WriteErrorLog("GetAssayProjectParamInfo(string projectName, string  samplType) == " + ex.Message, Module.LISSetting);
            }
            return(assayProjectParamInfo);
        }
Example #12
0
        //二点法
        public static float TwoPoint(TimeCourseInfo TC, AssayProjectParamInfo AR, string VolType)
        {
            float[] AbsList  = null;
            float[] TimeList = null;
            ProcessAbsLinear(TC, AR, out AbsList, out TimeList, VolType);

            float SecondPointSum = 0;

            for (int i = AR.MeasureLightDot3; i <= AR.MeasureLightDot4; i++)
            {
                SecondPointSum += AbsList[i - 1];
            }
            float SecondPointAbs = SecondPointSum / (AR.MeasureLightDot4 - AR.MeasureLightDot3 + 1);

            float FirstPointSum = 0;

            for (int i = AR.MeasureLightDot1; i <= AR.MeasureLightDot2; i++)
            {
                FirstPointSum += AbsList[i - 1];
            }
            float FirstPointAbs = FirstPointSum / (AR.MeasureLightDot2 - AR.MeasureLightDot1 + 1);

            return(SecondPointAbs - FirstPointAbs);
        }
Example #13
0
        /// <summary>
        /// 获取所有项目
        ///     对所有项目进行校验,如果校验通过字体就显示为黑色,不通过就显示为橙色(提示警告信息),或者该项目没有对应的校准品,就显示灰色(不可用)
        /// </summary>
        /// <param name="strDBMethod"></param>
        /// <param name="sampleType"></param>
        /// <returns></returns>
        public List <string[]> QueryProjectNameInfoByCalib(string strDBMethod, string sampleType)
        {
            List <string>   lstProjectByCalib = myBatis.QueryProjectNameInfoByCalib(strDBMethod, sampleType);
            List <string[]> lstProjectName    = new List <string[]>();

            foreach (string project in lstProjectByCalib)
            {
                string[] projectInfo = new string[6];
                projectInfo[0] = project;
                //1.项目参数信息
                AssayProjectParamInfo assayProParam = myBatis.GetAssayProjectParamInfoByNameAndType("GetAssayProjectParamInfoByNameAndType", new AssayProjectInfo()
                {
                    ProjectName = project, SampleType = sampleType
                });
                //2.校准品信息
                List <CalibratorProjectinfo> calib = myBatis.QueryCalibProjectInfo("QueryCalibProjectInfo", new CalibratorProjectinfo()
                {
                    ProjectName = project, SampleType = sampleType
                });
                //3.试剂信息
                ReagentStateInfoR1R2 reagentState = myBatis.QueryReagentStateInfoByProjectName("QueryReagentStateInfoByProjectName", new ReagentSettingsInfo()
                {
                    ProjectName = project, ReagentType = sampleType
                });
                // 4.判断校准曲线是否可用
                string calibMethod = myBatis.CalibParamInfoByProNameAndType("CalibParamInfoByProNameAndType", new string[] { project, sampleType });
                //5.判断该项目下的任务是否已完成
                int calibTaskCout = myBatis.QueryCalibTaskByProjectAndSamType("QueryCalibTaskByProjectAndSamType", new CalibratorinfoTask()
                {
                    ProjectName = project, SampleType = sampleType
                });
                //5. 判断该项校准方法中是否有校准品为空
                string strResult = myBatis.CalibProParamInfo_CalibNameIsEmpty(project, sampleType);
                if (calib.Count == 0)
                {
                    projectInfo[2] = "此项目没有对应的校准品!";
                    lstProjectName.Add(projectInfo);
                }
                else
                {
                    if (assayProParam != null)
                    {
                        if (assayProParam.AnalysisMethod == "" || assayProParam.AnalysisMethod == null)
                        {
                            projectInfo[2] = "此项目参数录入有误!";
                        }

                        if (reagentState == null)
                        {
                            projectInfo[3] = "此项目没有对应试剂!";
                        }
                        else if (reagentState.Locked == true)
                        {
                            projectInfo[3] = "此项目对应试剂被锁定,无法使用!";
                        }
                        else if (reagentState.ReagentName != null && reagentState.ReagentName != "" && reagentState.ValidPercent < 3)
                        {
                            projectInfo[3] = "此项目对应的试剂1余量不足!";
                        }
                        else if (reagentState.ReagentName2 != null && reagentState.ReagentName2 != "" && reagentState.ValidPercent2 < 3)
                        {
                            projectInfo[3] = "此项目对应的试剂2余量不足!";
                        }
                        if (calibMethod == null)
                        {
                            projectInfo[4] = "此项目没有对应的较准方法";
                        }
                        if (calibTaskCout != 0)
                        {
                            projectInfo[5] = "此项目已下任务,请做完此项目任务后才能继续下该项目任务!";
                        }
                        else if (strResult != "")
                        {
                            projectInfo[5] = strResult;
                        }

                        if (projectInfo[2] == null && projectInfo[3] == null && projectInfo[4] == null && projectInfo[5] == null)
                        {
                            projectInfo[1] = "true";
                        }
                        else
                        {
                            projectInfo[1] = "false";
                        }
                    }
                    else
                    {
                        projectInfo[1] = "false";
                        projectInfo[2] = "此项目参数录入有误!";
                        projectInfo[4] = "此项目没有对应的较准曲线";

                        if (reagentState == null)
                        {
                            projectInfo[3] = "此项目没有对应试剂!";
                        }
                        else if (reagentState.Locked == true)
                        {
                            projectInfo[3] = "此项目对应试剂被锁定,无法使用!";
                        }
                    }
                    lstProjectName.Add(projectInfo);
                }
            }
            return(lstProjectName);
        }
Example #14
0
        public List <string[]> QueryProNameForApplyTask(string StrmethodName, string sampleType)
        {
            List <string[]> lstProjectsInfo = new List <string[]>();

            List <string> lstProjects = myBatis.QueryProNameForApplyTask(StrmethodName, sampleType);

            foreach (string project in lstProjects)
            {
                string[] projectInfo = new string[5];
                projectInfo[0] = project;
                // 1.判断项目参数是否有效
                AssayProjectParamInfo assayProParam = myBatis.GetAssayProjectParamInfoByNameAndType("GetAssayProjectParamInfoByNameAndType", new AssayProjectInfo()
                {
                    ProjectName = project, SampleType = sampleType
                });
                // 2.判断试剂是否存在
                ReagentStateInfoR1R2 reagentState = myBatis.QueryReagentStateInfoByProjectName("QueryReagentStateInfoByProjectName", new ReagentSettingsInfo()
                {
                    ProjectName = project, ReagentType = sampleType
                });
                // 3.判断校准曲线是否可用
                bool bExist = myBatis.CalibCurveBeExistByProNameAndType("CalibCurveBeExistByProNameAndType", new string[] { project, sampleType });
                if (assayProParam != null)
                {
                    if (assayProParam.AnalysisMethod == "" || assayProParam.AnalysisMethod == null)
                    {
                        projectInfo[2] = "该项目参数录入有误!";
                    }

                    if (reagentState == null)
                    {
                        projectInfo[3] = "该项目没有对应试剂!";
                    }
                    else if (reagentState.Locked == true)
                    {
                        projectInfo[3] = "该项目对应试剂被锁定,无法使用!";
                    }
                    else if (reagentState.ReagentName != "" && reagentState.ReagentName != null && reagentState.ValidPercent < 3)
                    {
                        projectInfo[3] = "此项目对应的试剂1余量不足!";
                    }
                    else if (reagentState.ReagentName2 != "" && reagentState.ReagentName2 != null && reagentState.ValidPercent2 < 3)
                    {
                        projectInfo[3] = "此项目对应的试剂2余量不足!";
                    }

                    if (bExist == false)
                    {
                        projectInfo[4] = "该项目没有对应的较准曲线";
                    }


                    if (projectInfo[2] != null || projectInfo[3] != null || projectInfo[4] != null)
                    {
                        projectInfo[1] = "false";
                    }
                    else
                    {
                        projectInfo[1] = "true";
                    }
                }
                else
                {
                    projectInfo[1] = "false";
                    projectInfo[2] = "该项目参数录入有误!";
                    projectInfo[4] = "该项目没有对应的较准曲线";
                    if (reagentState == null)
                    {
                        projectInfo[3] = "该项目没有对应试剂!";
                    }
                    else if (reagentState.Locked == true)
                    {
                        projectInfo[3] = "该项目对应试剂被锁定,无法使用!";
                    }
                    else if (reagentState.ReagentName != "" && reagentState.ValidPercent < 3)
                    {
                        projectInfo[3] = "此项目对应的试剂1余量不足!";
                    }
                    else if (reagentState.ReagentName2 != "" && reagentState.ValidPercent2 < 3)
                    {
                        projectInfo[3] = "此项目对应的试剂2余量不足!";
                    }
                }
                lstProjectsInfo.Add(projectInfo);
            }
            return(lstProjectsInfo);
        }
Example #15
0
        public float GetResultConcValue(ResultInfo samResultInfo)
        {
            float        c     = 0;
            SDTTableItem table = new SDTTableItem();
            AssayProjectCalibrationParamInfo calParam = myBatis.GetAssayProjectCalParamInfo(samResultInfo.ProjectName, samResultInfo.SampleType) as AssayProjectCalibrationParamInfo;

            if (calParam.CalibrationMethod == "K系数法")
            {
                c = CalculateConc.GetKConftMethodConc(calParam, samResultInfo.AbsValue);
            }
            else
            {
                table = myBatis.GetAssayUsingTable(samResultInfo.ProjectName, samResultInfo.SampleType);
                c     = CalculateConc.GetConc(table, samResultInfo.AbsValue);
            }

            //table = myBatis.GetAssayUsingTable(samResultInfo.ProjectName, samResultInfo.SampleType);
            ////曲线拟合计算样本浓度值
            //c = CalculateConc.GetConc(table, samResultInfo.AbsValue);

            //修正定标体积和样本体积差异
            AssayProjectParamInfo assayProParam = myBatis.GetAssProParamInfo("GetAssayProjectParamInfoByNameAndType", samResultInfo.ProjectName, samResultInfo.SampleType);

            if (assayProParam == null)
            {
                return(0);
            }

            string dilutionType = "";

            if (samResultInfo.GetType().Name == "SampleResultInfo")
            {
                dilutionType = myBatis.GetSampleTaskDilutionType(samResultInfo as SampleResultInfo);
            }
            else
            {
                dilutionType = "常规体积";
            }
            //定标体积校正
            float SampleVol = 0;
            float SdtVol    = 0;

            if (assayProParam != null)
            {
                if (assayProParam.CalibSamVol == 0)
                {
                    SdtVol = assayProParam.CalibStosteVol;
                }
                else
                {
                    SdtVol = assayProParam.CalibSamVol;
                }

                switch (dilutionType)
                {
                case "减量体积":    //减量体积
                    if (assayProParam.DecSamVol == 0)
                    {
                        SampleVol = assayProParam.DecStosteVol;
                    }
                    else
                    {
                        SampleVol = assayProParam.DecSamVol;
                    }
                    break;

                case "增量体积":    //增量体积
                    if (assayProParam.IncSamVol == 0)
                    {
                        SampleVol = assayProParam.IncStosteVol;
                    }
                    else
                    {
                        SampleVol = assayProParam.IncSamVol;
                    }
                    break;

                case "常规体积":    //常规体积
                    if (assayProParam.ComSamVol == 0)
                    {
                        SampleVol = assayProParam.ComStosteVol;
                    }
                    else
                    {
                        SampleVol = assayProParam.ComSamVol;
                    }
                    break;

                case "自定义":
                    break;
                }
            }
            if (table != null /*&& table.SDTCurve != "Absolute"*/)//
            {
                float k1 = SdtVol / (SdtVol + (assayProParam.Reagent1Vol == 100000000 ? 0 : assayProParam.Reagent1Vol) + (assayProParam.Reagent2Vol == 100000000 ? 0 : assayProParam.Reagent2Vol)) * (SampleVol + (assayProParam.Reagent1Vol == 100000000 ? 0 : assayProParam.Reagent1Vol) + (assayProParam.Reagent2Vol == 100000000 ? 0 : assayProParam.Reagent2Vol)) / SampleVol;
                c = c * k1;
            }

            //原液体积折算
            float k = 1.0f;

            if (assayProParam != null && table != null)
            {
                switch (dilutionType)
                {
                case "减量体积":
                    k = (assayProParam.DecStosteVol + assayProParam.DecDilutionVol) / assayProParam.DecStosteVol;
                    break;

                case "增量体积":
                    k = (assayProParam.IncStosteVol + assayProParam.IncDilutionVol) / assayProParam.IncStosteVol;
                    break;

                case "常规体积":
                    k = (assayProParam.ComStosteVol + assayProParam.ComDilutionVol) / assayProParam.ComStosteVol;
                    break;

                case "自定义":
                    break;
                }

                /*
                 * if (table.SDTCurve == "Absolute")
                 * {
                 *  c = c * 1.0f;
                 * }
                 * else*/
                {
                    c = c * k;
                }
            }


            if (assayProParam != null)
            {
                c = c * assayProParam.InstrumentFactorA + assayProParam.InstrumentFactorB;
            }


            return(c);
        }
Example #16
0
        //获取每个吸光度读数点
        //public static float[] ProcessAbsList(TimeCourse T, AssayRunPara A)
        //{
        //    AssayValuePara AV = new AssayValueParaService().Get(A.Name) as AssayValuePara;
        //    float[] AbsList = new float[MachineInfo.LastAbsPoint];
        //    for (int i = 0; i < MachineInfo.LastAbsPoint; i++)
        //    {
        //        float c = A.SubWaveLength == 0 ? (T.CuvXWmList[i] - T.CuvBlkWm) : ((T.CuvXWmList[i] - T.CuvBlkWm) - (T.CuvXWsList[i] - T.CuvBlkWs));
        //        if (AV != null)
        //        {
        //            AbsList[i] = c * AV.EquipAdjustRfA + AV.EquipAdjustRfB;
        //        }
        //        else
        //        {
        //            AbsList[i] = c;
        //        }


        //    }
        //    return AbsList;
        //}
        //获取每个吸光度读数点
        public static float[] ProcessAbsList(TimeCourseInfo T, AssayProjectParamInfo A, string VT)
        {
            float[] AbsList = new float[RunConfigureUtility.LastPoint];
            for (int i = 0; i < RunConfigureUtility.LastPoint; i++)
            {
                float c = A.SecWaveLength == 0 ? (T.CuvXWmList[i] - T.CuvBlkWm) : ((T.CuvXWmList[i] - T.CuvBlkWm) - (T.CuvXWsList[i] - T.CuvBlkWs));

                //R2体积修正
                if ((A != null) && (A.AnalysisMethod == "二点终点法" || A.AnalysisMethod == "速率B法") && i < (RunConfigureUtility.R2Point - 1))
                {
                    float k = 1;
                    switch (VT)
                    {
                    case "减量体积":
                        if (A.DecSamVol != 0)
                        {
                            k = (A.Reagent1VolSettings + A.DecSamVol) / (A.Reagent1VolSettings + A.Reagent2VolSettings + A.DecSamVol);
                        }
                        else
                        {
                            k = (A.Reagent1VolSettings + A.DecStosteVol) / (A.Reagent1VolSettings + A.Reagent2VolSettings + A.DecStosteVol);
                        }
                        break;

                    case "常规体积":
                        if (A.ComSamVol != 0)
                        {
                            k = (A.Reagent1VolSettings + A.ComSamVol) / (A.Reagent1VolSettings + A.Reagent2VolSettings + A.ComSamVol);
                        }
                        else
                        {
                            k = (A.Reagent1VolSettings + A.ComStosteVol) / (A.Reagent1VolSettings + A.Reagent2VolSettings + A.ComStosteVol);
                        }
                        break;

                    case "增量体积":
                        if (A.IncSamVol != 0)
                        {
                            k = (A.Reagent1VolSettings + A.IncSamVol) / (A.Reagent1VolSettings + A.Reagent2VolSettings + A.IncSamVol);
                        }
                        else
                        {
                            k = (A.Reagent1VolSettings + A.IncStosteVol) / (A.Reagent1VolSettings + A.Reagent2VolSettings + A.IncStosteVol);
                        }
                        break;

                    case "定标体积":
                        if (A.CalibSamVol != 0)
                        {
                            k = (A.Reagent1VolSettings + A.CalibSamVol) / (A.Reagent1VolSettings + A.Reagent2VolSettings + A.CalibSamVol);
                        }
                        else
                        {
                            k = (A.Reagent1VolSettings + A.CalibStosteVol) / (A.Reagent1VolSettings + A.Reagent2VolSettings + A.CalibStosteVol);
                        }
                        break;

                    case "自定义":
                        break;
                    }
                    c = c * k;
                }

                AbsList[i] = c;
            }
            return(AbsList);
        }
Example #17
0
        public void AnalyzeResult(SampleResultInfo r)
        {
            AssayProjectParamInfo A = myBatis.GetAssayProjectParamInfoByNameAndType("GetAssayProjectParamInfoByNameAndType", new AssayProjectInfo()
            {
                ProjectName = r.ProjectName, SampleType = r.SampleType
            });

            if (A == null)
            {
                return;
            }
            TimeCourseInfo T = myBatis.GetTimeCourse(r.TCNO, r.SampleCreateTime);

            if (T == null)
            {
                return;
            }
            SampleInfo S = myBatis.GetSample(r.SampleNum, r.SampleCreateTime);

            if (S == null)
            {
                return;
            }
            AssayProjectRangeParamInfo ARP = myBatis.GetRangeParamInfo(r.ProjectName, r.SampleType);

            if (ARP == null)
            {
                return;
            }
            ProjectRunSequenceInfo proRunSequence = myBatis.QueryProjectRunSequenceByProject(new AssayProjectInfo()
            {
                ProjectName = r.ProjectName, SampleType = r.SampleType
            });

            if (proRunSequence == null)
            {
                return;
            }
            //试剂吸光度判读,检测试剂是否正常
            string RgtAbsFlag = null;
            float  RgtAbs     = ABSProcess.GetReangentAbs(T, A);

            if (A.ReagentBlankMaximum > 0.000001 && A.ReagentBlankMaximum < RgtAbs)
            {
                RgtAbsFlag = "RgtAbsMax";
            }
            if (A.ReagentBlankMaximum > 0.000001 && A.ReagentBlankMinimum > RgtAbs)
            {
                RgtAbsFlag = "RgtAbsMin";
            }
            if (RgtAbsFlag != null)
            {
                if (string.IsNullOrEmpty(r.Remarks) || string.IsNullOrWhiteSpace(r.Remarks))
                {
                    r.Remarks = RgtAbsFlag;
                }
                else
                {
                    r.Remarks += "|" + RgtAbsFlag;
                }
                myBatis.UpdateNORResultRunLog(r);
                TroubleLog trouble = new TroubleLog();
                trouble.TroubleType = TROUBLETYPE.WARN;
                trouble.TroubleUnit = @"试剂";
                trouble.TroubleCode = "000002";
                trouble.TroubleInfo = string.Format(@"{0}:{1}发生试剂吸光度越界,其反应进程:{2}。请检测试剂是否过期. ", r.SampleNum, r.ProjectName, r.TCNO);
                myBatis.TroubleLogSave("TroubleLogSave", trouble);
            }


            //底物耗尽判断处理,
            string AbsLimFlag = null;
            float  AbsLimRef  = A.LimitValue;                  //(0--3.5)
            float  AbsLim     = ABSProcess.GetAbsLimAbs(T, A); //M2E abs

            if (A.AnalysisMethod == "速率A法" || A.AnalysisMethod == "速率B法")
            {
                if (A.ReactionDirection == "正反应")//正反应
                {
                    if (AbsLimRef > 0.000001 && AbsLimRef < AbsLim)
                    {
                        AbsLimFlag = "AbsLim";
                    }
                }
                if (A.ReactionDirection == "负反应")//负反应
                {
                    if (AbsLimRef > 0.000001 && AbsLimRef > AbsLim)
                    {
                        AbsLimFlag = "AbsLim";
                    }
                }
            }
            if (AbsLimFlag != null)
            {
                if (string.IsNullOrEmpty(r.Remarks) || string.IsNullOrWhiteSpace(r.Remarks))
                {
                    r.Remarks = AbsLimFlag;
                }
                else
                {
                    r.Remarks += "|" + AbsLimFlag;
                }
                myBatis.UpdateNORResultRunLog(r);

                TroubleLog trouble = new TroubleLog();
                trouble.TroubleType = TROUBLETYPE.ERR;
                trouble.TroubleUnit = @"样本";
                trouble.TroubleCode = "000003";
                trouble.TroubleInfo = string.Format(@"{0}:{1}发生底物耗尽,其反应进程:{2}", r.SampleNum, r.ProjectName, r.TCNO);
                myBatis.TroubleLogSave("TroubleLogSave", trouble);

                if (ARP.AutoRerun == true)
                {
                    //Schedule Schedule = new ScheduleService().GetSMPSchedule(r.SMPNO, r.ItemName) as Schedule;
                    TaskInfo task = myBatis.GetTask(r.ProjectName, r.SampleNum);
                    if (task == null)
                    {
                        task             = new TaskInfo();
                        task.SampleNum   = r.SampleNum;
                        task.ProjectName = r.ProjectName;
                        task.SampleType  = r.SampleType;
                        //Schedule.WorkType = S.IsEmergency == true ? WORKTYPE.E : WORKTYPE.N;
                        task.SampleDilute = "减量体积";
                        task.SendTimes    = 0;
                        task.FinishTimes  = 0;
                        task.InspectTimes = 1;
                        task.TaskState    = 0;
                        task.IsReRun      = true;
                        //Schedule.ReRun = "AbsLim";
                        if (r.ResultVolType != task.SampleDilute)//结果体积参数和计划体积参数不同才可以提交工作计划
                        {
                            //new ScheduleService().Save(Schedule);
                            myBatis.SaveTske(task);
                        }
                    }
                }
            }

            //技术 血清/尿液范围即线性范围判读
            float LineRefMin = 0.0f; //线性参考值
            float LineRefMax = 0.0f; //线性参考值

            switch (S.SampleType)
            {
            case "尿液":
            case "血清": LineRefMin = A.FirstSlope; LineRefMax = A.FirstSlopeHigh; break;
            }

            string LinFlag = null;

            try
            {
                float v = r.ConcResult;
                if (LineRefMax > 0.00001 && v > LineRefMax)
                {
                    LinFlag = "Lin.H";
                }
                if (LineRefMax > 0.00001 && v < LineRefMin)
                {
                    LinFlag = "Lin.L";
                }
            }
            catch
            {
            }
            if (LinFlag != null)
            {
                if (string.IsNullOrEmpty(r.Remarks) || string.IsNullOrWhiteSpace(r.Remarks))
                {
                    r.Remarks = LinFlag;
                }
                else
                {
                    r.Remarks += "|" + LinFlag;
                }
                myBatis.UpdateNORResultRunLog(r);
                TroubleLog trouble = new TroubleLog();
                trouble.TroubleType = TROUBLETYPE.ERR;
                trouble.TroubleUnit = @"样本";
                trouble.TroubleCode = "00001";
                trouble.TroubleInfo = string.Format(@"{0}:{1}线性范围违规,其反应进程:{2}", r.SampleNum, r.ProjectName, r.TCNO);
                myBatis.TroubleLogSave("TroubleLogSave", trouble);

                if (ARP.AutoRerun == true)
                {
                    //Schedule Schedule = new ScheduleService().GetSMPSchedule(r.SMPNO, r.ItemName) as Schedule;
                    TaskInfo task = myBatis.GetTask(r.ProjectName, r.SampleNum);
                    if (task == null)
                    {
                        task             = new TaskInfo();
                        task.SampleNum   = r.SampleNum;
                        task.ProjectName = r.ProjectName;
                        task.SampleType  = r.SampleType;
                        //Schedule.WorkType = S.IsEmergency == true ? WORKTYPE.E : WORKTYPE.N;
                        switch (LinFlag)
                        {
                        case "Lin.L": task.SampleDilute = "增量体积"; break;

                        case "Lin.H": task.SampleDilute = "减量体积"; break;
                        }
                        task.SendTimes    = 0;
                        task.FinishTimes  = 0;
                        task.InspectTimes = 1;
                        task.TaskState    = 0;
                        task.IsReRun      = true;
                        //Schedule.ReRun = "AbsLim";
                        if (r.ResultVolType != task.SampleDilute)//结果体积参数和计划体积参数不同才可以提交工作计划
                        {
                            //new ScheduleService().Save(Schedule);
                            myBatis.SaveTske(task);
                        }
                    }
                }
            }

            //血清结果浓度临界判读,只对血清样本起作用。
            if (S.SampleType == "血清")
            {
                string PanicFlag = null;
                try
                {
                    float v = r.ConcResult;
                    if (A.SerumCriticalMaximum > 0.00001 && A.SerumCriticalMaximum < v)
                    {
                        PanicFlag = "Panic.H";
                    }
                    if (A.SerumCriticalMaximum > 0.00001 && A.SerumCriticalMinimum > v)
                    {
                        PanicFlag = "Panic.L";
                    }
                }
                catch
                {
                }
                if (PanicFlag != null)
                {
                    if (string.IsNullOrEmpty(r.Remarks) || string.IsNullOrWhiteSpace(r.Remarks))
                    {
                        r.Remarks = PanicFlag;
                    }
                    else
                    {
                        r.Remarks += "|" + PanicFlag;
                    }
                    myBatis.UpdateNORResultRunLog(r);

                    TroubleLog trouble = new TroubleLog();
                    trouble.TroubleType = TROUBLETYPE.ERR;
                    trouble.TroubleUnit = @"样本";
                    trouble.TroubleCode = "00001";
                    trouble.TroubleInfo = string.Format(@"{0}:{1}发生血清临界值违规,其反应进程:{2}", r.SampleNum, r.ProjectName, r.TCNO);
                    myBatis.TroubleLogSave("TroubleLogSave", trouble);

                    if (ARP.AutoRerun == true)
                    {
                        //Schedule Schedule = new ScheduleService().GetSMPSchedule(r.SMPNO, r.ItemName) as Schedule;
                        TaskInfo task = myBatis.GetTask(r.ProjectName, r.SampleNum);
                        if (task == null)
                        {
                            task             = new TaskInfo();
                            task.SampleNum   = r.SampleNum;
                            task.ProjectName = r.ProjectName;
                            task.SampleType  = r.SampleType;
                            //Schedule.WorkType = S.IsEmergency == true ? WORKTYPE.E : WORKTYPE.N;
                            switch (r.ResultVolType)
                            {
                            case VOLTYPE.IV: task.SampleDilute = "增量体积"; break;

                            case VOLTYPE.DV: task.SampleDilute = "减量体积"; break;

                            case VOLTYPE.NA: task.SampleDilute = "常规体积"; break;
                            }
                            task.SendTimes    = 0;
                            task.FinishTimes  = 0;
                            task.InspectTimes = 1;
                            task.TaskState    = 0;
                            task.IsReRun      = true;
                            //Schedule.ReRun = "AbsLim";
                            if (r.ResultVolType != task.SampleDilute)//结果体积参数和计划体积参数不同才可以提交工作计划
                            {
                                //new ScheduleService().Save(Schedule);
                                myBatis.SaveTske(task);
                            }
                        }
                    }
                }
            }

            //前驱界限,该值是个比例
            string ProzontLimitPanicFlag = null;
            float  ProzontLimit          = ABSProcess.GetProzontLimitValue(T, A, r.ResultVolType, S.SampleType);

            if (A.ProLowestBound > 0.000001)
            {
                if (ProzontLimit > A.ProLowestBound / 100)
                {
                    ProzontLimitPanicFlag = "P*";
                }
            }
            if (ProzontLimitPanicFlag != null)
            {
                if (string.IsNullOrEmpty(r.Remarks) || string.IsNullOrWhiteSpace(r.Remarks))
                {
                    r.Remarks = ProzontLimitPanicFlag;
                }
                else
                {
                    r.Remarks += "|" + ProzontLimitPanicFlag;
                }
                myBatis.UpdateNORResultRunLog(r);
                TroubleLog trouble = new TroubleLog();
                trouble.TroubleType = TROUBLETYPE.ERR;
                trouble.TroubleUnit = @"样本";
                trouble.TroubleCode = "00001";
                trouble.TroubleInfo = string.Format(@"{0}:{1}前驱界限违规!反应进程:{2}", r.SampleNum, r.ProjectName, r.TCNO);
                myBatis.TroubleLogSave("TroubleLogSave", trouble);
                if (ARP.AutoRerun == true)
                {
                    //Schedule Schedule = new ScheduleService().GetSMPSchedule(r.SMPNO, r.ItemName) as Schedule;
                    TaskInfo task = myBatis.GetTask(r.ProjectName, r.SampleNum);
                    if (task == null)
                    {
                        task             = new TaskInfo();
                        task.SampleNum   = r.SampleNum;
                        task.ProjectName = r.ProjectName;
                        task.SampleType  = r.SampleType;
                        //Schedule.WorkType = S.IsEmergency == true ? WORKTYPE.E : WORKTYPE.N;
                        task.SampleDilute = "减量体积";
                        task.SendTimes    = 0;
                        task.FinishTimes  = 0;
                        task.InspectTimes = 1;
                        task.TaskState    = 0;
                        task.IsReRun      = true;
                        //Schedule.ReRun = "AbsLim";
                        if (r.ResultVolType != task.SampleDilute)//结果体积参数和计划体积参数不同才可以提交工作计划
                        {
                            //new ScheduleService().Save(Schedule);
                            myBatis.SaveTske(task);
                        }
                    }
                }
            }
        }
Example #18
0
 /// <summary>
 /// 根据项目名称更新改项目参数信息
 /// </summary>
 /// <param name="strDBMethod"></param>
 /// <param name="strProName"></param>
 public int UpdateAssayProjectParamInfo(string strDBMethod, AssayProjectParamInfo assayProParamInfo)
 {
     return(myBatis.UpdateAssayProjectParamInfo(strDBMethod, assayProParamInfo));
 }
Example #19
0
        /// <summary>
        /// 保存生化项目参数信息,范围参数信息和校准参数信息
        /// </summary>
        /// <param name="ReagentItem"></param>
        void DoSaveAssayPorjectPara(ReagentItem ReagentItem, string reagentType)
        {
            //实例化生化项目参数实体
            AssayProjectParamInfo a = new AssayProjectParamInfo();

            a.ProjectName = ReagentItem.ItemName;
            //分析方法
            switch (ReagentItem.AnalyzeMethod)
            {
            case "1Point":
                a.AnalysisMethod = "一点终点法";
                break;

            case "2Point":
                a.AnalysisMethod = "二点终点法";
                break;

            case "Arate":
                a.AnalysisMethod = "速率A法";
                break;

            case "Brate":
                a.AnalysisMethod = "速率B法";
                break;
            }
            a.SampleType = reagentType;
            //第一测试点S
            a.MeasureLightDot1 = ReagentItem.FirstPointS;
            //第一测试点E
            a.MeasureLightDot2 = ReagentItem.FirstPointE;
            //第二测试点S
            a.MeasureLightDot3 = ReagentItem.SecondPointS;
            //第二测试点E
            a.MeasureLightDot4 = ReagentItem.SecondPointE;
            //主波长
            a.MainWaveLength = ReagentItem.MainWaveLength;
            //次波长
            a.SecWaveLength = ReagentItem.SubWaveLength;
            //单位
            a.ResultUnit = ReagentItem.Unit;
            //仪器因素
            a.InstrumentFactorA = 1;
            a.InstrumentFactorB = 0;
            //试剂1体积
            a.Reagent1VolSettings = ReagentItem.R1Vol;
            //试剂2体积
            a.Reagent2VolSettings = ReagentItem.R2Vol;
            //样本反应体积
            a.IncStosteVol     = ReagentItem.IncreaseVol;
            a.IncSamVol        = 0;
            a.IncDilutionVol   = 0;
            a.ComStosteVol     = ReagentItem.NormalVol;
            a.ComSamVol        = 0;
            a.ComDilutionVol   = 0;
            a.DecStosteVol     = ReagentItem.DecreaseVol;
            a.DecSamVol        = 0;
            a.DecDilutionVol   = 0;
            a.CalibStosteVol   = ReagentItem.SDTVol;
            a.CalibSamVol      = 0;
            a.CalibDilutionVol = 0;
            //反应方向
            switch (ReagentItem.ReacteDirect)
            {
            case 1:
                a.ReactionDirection = "正反应";
                break;

            case -1:
                a.ReactionDirection = "负反应";
                break;
            }
            //搅拌强度
            switch (ReagentItem.Stiring1Force) // 搅拌1强度
            {
            case 1:
                a.Stirring1Intensity = "低";
                break;

            case 2:
                a.Stirring1Intensity = "中";
                break;

            case 3:
                a.Stirring1Intensity = "高";
                break;
            }
            switch (ReagentItem.Stiring2Force) // 搅拌2强度
            {
            case 1:
                a.Stirring2Intensity = "低";
                break;

            case 2:
                a.Stirring2Intensity = "中";
                break;

            case 3:
                a.Stirring2Intensity = "高";
                break;
            }

            //int m = new RGTPOSManager().GetReagentMode(); //等测试后是否需要加


            a.FirstSlope           = ReagentItem.LineSerumLimitMin;
            a.FirstSlopeHigh       = ReagentItem.LineSerumLimitMax;
            a.ReagentBlankMinimum  = ReagentItem.ReagentAbsMin;
            a.ReagentBlankMaximum  = ReagentItem.ReagentAbsMax;
            a.SerumCriticalMinimum = ReagentItem.SerumPanicLimitMin;
            a.SerumCriticalMaximum = ReagentItem.SerumPanicLimitMax;

            mybatis.SaveRGSpendingAssayProjectInfo(a);

            mybatis.SaveRangeParamAndCalibParam(ReagentItem.ItemName, reagentType, ReagentItem.SDTCount);
        }
Example #20
0
        public List <string[]> QueryProjectNameInfoByQC(string strDBMethod, QualityControlInfo qcInfo, string strSampleType)
        {
            List <string> lstProjectByQC = myBatis.QueryProjectNameInfoByQC(strDBMethod, qcInfo, strSampleType, out qcId);

            //判断该项目下的任务是否已完成
            int QCcount = myBatis.QueryQCTaskByProjectAndSamType("QueryQCTaskByProjectAndSamType", qcId);

            List <string[]> lstProjectInfo = new List <string[]>();

            foreach (string project in lstProjectByQC)
            {
                string[] projectInfo = new string[6];
                projectInfo[0] = project;
                AssayProjectParamInfo assayProParam = myBatis.GetAssayProjectParamInfoByNameAndType("GetAssayProjectParamInfoByNameAndType", new AssayProjectInfo()
                {
                    ProjectName = project, SampleType = strSampleType
                });
                ReagentStateInfoR1R2 reagentState = myBatis.QueryReagentStateInfoByProjectName("QueryReagentStateInfoByProjectName", new ReagentSettingsInfo()
                {
                    ProjectName = project, ReagentType = strSampleType
                });
                // 3.判断校准曲线是否可用
                bool bExist = myBatis.CalibCurveBeExistByProNameAndType("CalibCurveBeExistByProNameAndType", new string[] { project, strSampleType });

                if (assayProParam != null)
                {
                    if (assayProParam.AnalysisMethod == "" || assayProParam.AnalysisMethod == null)
                    {
                        projectInfo[2] = "该项目参数录入有误!";
                    }

                    if (reagentState == null)
                    {
                        projectInfo[3] = "该项目没有对应试剂!";
                    }
                    else if (reagentState.ReagentName == "" || reagentState.ReagentName == null || reagentState.ValidPercent < 3)
                    {
                        projectInfo[3] = "此项目对应的试剂1余量不足!";
                    }
                    else if (reagentState.ReagentName2 == "" || reagentState.ReagentName2 == null || reagentState.ValidPercent2 < 3)
                    {
                        projectInfo[3] = "此项目对应的试剂2余量不足!";
                    }
                    else if (reagentState.Locked == true)
                    {
                        projectInfo[3] = "该项目对应试剂被锁定,无法使用!";
                    }

                    if (bExist == false)
                    {
                        projectInfo[4] = "该项目没有对应的较准曲线";
                    }
                    if (QCcount != 0)
                    {
                        projectInfo[5] = "此项目已下任务,请做完此项目任务后才能继续下该项目任务!";
                    }
                    if (projectInfo[2] == null && projectInfo[3] == null && projectInfo[4] == null && projectInfo[5] == null)
                    {
                        projectInfo[1] = "true";
                    }
                    else
                    {
                        projectInfo[1] = "false";
                    }
                }
                else
                {
                    projectInfo[1] = "false";
                    projectInfo[2] = "该项目参数录入有误!";
                    projectInfo[4] = "该项目没有对应的较准曲线";

                    if (reagentState == null)
                    {
                        projectInfo[3] = "该项目没有对应试剂!";
                    }
                    else if (reagentState.Locked == true)
                    {
                        projectInfo[3] = "该项目对应试剂被锁定,无法使用!";
                    }
                }
                lstProjectInfo.Add(projectInfo);
            }
            return(lstProjectInfo);
        }
Example #21
0
        /// <summary>
        /// 接收数据传到窗体
        /// </summary>
        /// <param name="strMethod"></param>
        /// <param name="sender"></param>
        public void DataTransfer_Event(string strMethod, object sender)
        {
            switch (strMethod)
            {
            case "QueryProjectResultUnits":
                projectParameter.LstUnits = (List <string>)XmlUtility.Deserialize(typeof(List <string>), sender as string);
                break;

            case "QueryAssayProAllInfo":
                lstAssayProInfos = (List <AssayProjectInfo>)XmlUtility.Deserialize(typeof(List <AssayProjectInfo>), sender as string);
                this.Invoke(new EventHandler(delegate
                {
                    if (xtraTabControl1.SelectedTabPageIndex == 0)
                    {
                        projectParameter.LstAssayProInfos = lstAssayProInfos;
                    }
                    else if (xtraTabControl1.SelectedTabPageIndex == 1)
                    {
                        calibrationParameter.LstAssayProInfos = lstAssayProInfos;
                    }
                    else
                    {
                        rangeParameter.LstAssayProInfos = lstAssayProInfos;
                    }
                }));
                break;

            case "AssayProjectAdd":
                AssayProjectParamInfo assayProjectParamInfo = (AssayProjectParamInfo)XmlUtility.Deserialize(typeof(AssayProjectParamInfo), sender as string);
                projectParameter.AssayProjectParamInfos = assayProjectParamInfo;
                break;

            case "AssayProjectEdit":
                projectParameter.EnditOrDeleteProInfoHandle = (int)sender;
                if ((int)sender == 0)
                {
                    this.Invoke(new EventHandler(delegate
                    {
                        chemicalParamDic.Clear();
                        chemicalParamDic.Add("QueryAssayProAllInfo", new object[] { "" });
                        AssayProInfo_Event(chemicalParamDic);
                        QueryResultSetTb queryRsult              = new QueryResultSetTb(true);
                        List <ResultSetInfo> lstqueryResult      = QueryResultSetTb.QueryResultSetInfo;
                        projectParameter.LstAssayProParamInfoAll = new SettingsChemicalParameter().QueryAssayProjectParamInfoAll("QueryAssayProjectParamInfoAll", QueryResultSetTb.QueryResultSetInfo);
                    }));
                }
                else
                {
                    MessageBoxDraw.ShowMsg("请检查校准品、质控品、计算项目和组合项目是否包含修改的项目,如果存在,不能修改!", MsgType.Warning);
                    return;
                }
                break;

            case "AssayProjectDelete":
                if ((int)sender == 0)
                {
                    this.Invoke(new EventHandler(delegate
                    {
                        chemicalParamDic.Clear();
                        chemicalParamDic.Add("QueryAssayProAllInfo", new object[] { "" });
                        AssayProInfo_Event(chemicalParamDic);
                        QueryResultSetTb queryRsult         = new QueryResultSetTb(true);
                        List <ResultSetInfo> lstqueryResult = QueryResultSetTb.QueryResultSetInfo;
                    }));
                }
                else
                {
                    MessageBoxDraw.ShowMsg("请检查校准品、质控品、计算项目和组合项目是否包含被删除的项目,如果存在,不能删除!", MsgType.Warning);
                    return;
                }
                break;

            case "UpdateCalibParamByProNameAndType":
                calibrationParameter.ProcessSuccessOrFailureInfo(sender as string);
                break;

            case "UpdateAssayProjectParamInfo":
                if ((int)sender == 0)
                {
                    projectParameter.StrReceiveInfo = "保存失败!";
                }
                else
                {
                    projectParameter.StrReceiveInfo = "保存成功!";
                }
                break;

            case "QueryAssayProAllInfoForCalibParam":       // 为校准参数界面获取所有项目信息
                //lstAssayProInfos = (List<AssayProjectInfo>)XmlUtility.Deserialize(typeof(List<AssayProjectInfo>), sender as string);
                //calibrationParameter.LstAssayProInfos = lstAssayProInfos;
                break;

            case "QueryCalibParamInfoAll":
                //List<AssayProjectCalibrationParamInfo> lstCalibParamInfo = (List<AssayProjectCalibrationParamInfo>)XmlUtility.Deserialize(typeof(List<AssayProjectCalibrationParamInfo>), sender as string);
                //calibrationParameter.LstCalibParamInfo = lstCalibParamInfo;
                //calibrationParameter.LstAssayProInfos = lstAssayProInfos;
                break;

            case "QueryAssayProAllInfoForRangeParam":
                //lstAssayProInfos = (List<AssayProjectInfo>)XmlUtility.Deserialize(typeof(List<AssayProjectInfo>), sender as string);
                //rangeParameter.LstAssayProInfos = lstAssayProInfos;
                break;

            case "QueryRangeParamByProNameAndType":
                AssayProjectRangeParamInfo rangeParamInfo = (AssayProjectRangeParamInfo)XmlUtility.Deserialize(typeof(AssayProjectRangeParamInfo), sender as string);
                rangeParameter.RangeParamInfo = rangeParamInfo;
                break;

            case "QueryCalibratorProinfo":
                //List<CalibratorProjectinfo> calibratorProjectinfo = (List<CalibratorProjectinfo>)XmlUtility.Deserialize(typeof(List<CalibratorProjectinfo>), sender as string);
                //this.Invoke(new EventHandler(delegate { calibrationParameter.AddCalibrator(calibratorProjectinfo); }));
                break;

            case "QueryCalib":
                //List<Calibratorinfo> lisCalibratorinfo = (List<Calibratorinfo>)XmlUtility.Deserialize(typeof(List<Calibratorinfo>), sender as string);
                //calibrationParameter.lisCalibratorinfo(lisCalibratorinfo);
                break;

            case "QueryCalibrationCurve":
                //List<CalibrationCurveInfo> calibrationCurveInfo = (List<CalibrationCurveInfo>)XmlUtility.Deserialize(typeof(List<CalibrationCurveInfo>), sender as string);
                //calibrationParameter.AddcalibrationCurveInfo(calibrationCurveInfo);
                break;

            default:
                break;
            }
        }
Example #22
0
        void RgtWarning(int d, int p)
        {
            float rgtwarncount  = myBatis.GetRgtWarnCount();
            float rgtleastcount = myBatis.GetRgtLeastCount();

            ReagentStateInfoR1R2 rgp = myBatis.GetReagentStateInfoByPos(d, p);
            ReagentSettingsInfo  rsi = myBatis.GetReagentSettingsInfoByPos(d, p);

            if (rgp != null)
            {
                AssayProjectParamInfo arp = myBatis.GetAssayProjectParamInfoByNameAndType("GetAssayProjectParamInfoByNameAndType", new AssayProjectInfo()
                {
                    ProjectName = rsi.ProjectName, SampleType = rsi.ReagentType
                });
                int c = 0;
                int v = System.Convert.ToInt32(rsi.ReagentContainer.Substring(0, rsi.ReagentContainer.IndexOf("ml"))) * (rgp.ValidPercent - 2) / 100 * 1000;

                switch (d)
                {
                case 1:
                    c = arp.Reagent1VolSettings == 0 ? 0 : v / arp.Reagent1VolSettings;
                    if (c < rgtleastcount)
                    {
                        //if (RunSer.IsMutiRgtEnable() == true)//多试剂位开关标志
                        //{
                        //    RGTPosition mrgt = RGTPOSMgr.GetEnableMutiRgtPosition(rgp);
                        //    if (mrgt != null)
                        //    {
                        //        RGTPOSMgr.BetweenMutiRgtPositionAndRgtPositionChange(mrgt, rgp);

                        //        TroubleLog trouble = new TroubleLog();
                        //        trouble.TroubleCode = @"0000773";
                        //        trouble.TroubleType = TROUBLETYPE.WARN;
                        //        trouble.TroubleUnit = "试剂";
                        //        trouble.TroubleInfo = "试剂位" + p + "项目" + rgp.Assay + "试剂1由于余量不足开始启用其多试剂位" + mrgt.Position;//string.Format("试剂位{0}项目{1}试剂1由于余量不足开始启用其多试剂位{2}. ", p, rgp.Assay, mrgt.Position);
                        //        TroubleLogSer.Save(trouble);
                        //    }
                        //    else
                        //    {
                        //        if (RunSer.IsLockRgtEnable() == true)
                        //        {
                        //            rgp.IsLocked = true;
                        //            RGTPOSMgr.UpdateLockState(rgp);

                        //            TroubleLog trouble = new TroubleLog();
                        //            trouble.TroubleCode = @"0000773";
                        //            trouble.TroubleType = TROUBLETYPE.WARN;
                        //            trouble.TroubleUnit = "试剂";
                        //            trouble.TroubleInfo = MyResources.Instance.FindResource("Parse0839").ToString() + p + MyResources.Instance.FindResource("Parse0832").ToString() + rgp.Assay + MyResources.Instance.FindResource("Parse08312").ToString();//string.Format("试剂位{0}项目{1}试剂1由于余量不足将锁定其对应的工作表. ", p, rgp.Assay);
                        //            TroubleLogSer.Save(trouble);
                        //        }
                        //        else
                        //        {
                        //            TroubleLog trouble = new TroubleLog();
                        //            trouble.TroubleCode = @"0000773";
                        //            trouble.TroubleType = TROUBLETYPE.ERR;
                        //            trouble.TroubleUnit = "试剂";
                        //            trouble.TroubleInfo = MyResources.Instance.FindResource("Parse0839").ToString() + p + MyResources.Instance.FindResource("Parse0832").ToString() + rgp.Assay + MyResources.Instance.FindResource("Parse08313").ToString();// string.Format("试剂位{0}项目{1}试剂1由于余量不足. ", p, rgp.Assay);
                        //            TroubleLogSer.Save(trouble);
                        //        }
                        //    }
                        //}
                        //else
                        //{
                        //if (RunSer.IsLockRgtEnable() == true)
                        //{
                        rsi.Locked = true;
                        myBatis.UpdateLockState("R1", rsi);

                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleCode = @"0000773";
                        trouble.TroubleType = TROUBLETYPE.WARN;
                        trouble.TroubleUnit = "试剂";
                        trouble.TroubleInfo = "试剂位" + p + "项目" + rgp.ProjectName + "余量不足将锁定其对应的工作表";    //string.Format("试剂位{0}项目{1}试剂1由于余量不足将锁定其对应的工作表. ", p, rgp.Assay);
                        myBatis.TroubleLogSave("TroubleLogSave", trouble);
                        //}
                        //else
                        //{
                        //    TroubleLog trouble = new TroubleLog();
                        //    trouble.TroubleCode = @"0000773";
                        //    trouble.TroubleType = TROUBLETYPE.ERR;
                        //    trouble.TroubleUnit = "试剂";
                        //    trouble.TroubleInfo = MyResources.Instance.FindResource("Parse0839").ToString() + p + MyResources.Instance.FindResource("Parse0832").ToString() + rgp.Assay + MyResources.Instance.FindResource("Parse08315").ToString();// string.Format("试剂位{0}项目{1}试剂1由于余量不足. ", p, rgp.Assay);
                        //    TroubleLogSer.Save(trouble);
                        //}
                        //}
                    }

                    if (c < rgtwarncount && c > rgtleastcount)
                    {
                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleCode = @"0000773";
                        trouble.TroubleType = TROUBLETYPE.WARN;
                        trouble.TroubleUnit = "试剂";
                        trouble.TroubleInfo = "试剂位" + p + "项目" + rgp.ProjectName + "试剂1即将耗尽";    // string.Format("试剂位{0}项目{1}:试剂1余量即将耗尽. ", p, rgp.Assay);
                        myBatis.TroubleLogSave("TroubleLogSave", trouble);
                        return;
                    }
                    break;

                case 2:
                    c = arp.Reagent2VolSettings == 0 ? 0 : v / arp.Reagent2VolSettings;
                    if (c < rgtleastcount)
                    {
                        //if (RunSer.IsMutiRgtEnable() == true)//多试剂位开关标志
                        //{
                        //    RGTPosition mrgt = RGTPOSMgr.GetEnableMutiRgtPosition(rgp);
                        //    if (mrgt != null)
                        //    {
                        //        RGTPOSMgr.BetweenMutiRgtPositionAndRgtPositionChange(mrgt, rgp);

                        //        TroubleLog trouble = new TroubleLog();
                        //        trouble.TroubleCode = @"0000773";
                        //        trouble.TroubleType = TROUBLETYPE.WARN;
                        //        trouble.TroubleUnit = "试剂";
                        //        trouble.TroubleInfo = MyResources.Instance.FindResource("Parse0839").ToString() + p + MyResources.Instance.FindResource("Parse0832").ToString() + rgp.Assay + MyResources.Instance.FindResource("Parse08317").ToString() + mrgt.Position;// string.Format("试剂位{0}项目{1}试剂2由于余量不足开始启用其多试剂位{2}. ", p, rgp.Assay, mrgt.Position);
                        //        TroubleLogSer.Save(trouble);
                        //    }
                        //    else
                        //    {
                        //        if (RunSer.IsLockRgtEnable() == true)
                        //        {
                        //            rgp.IsLocked = true;
                        //            RGTPOSMgr.UpdateLockState(rgp);

                        //            TroubleLog trouble = new TroubleLog();
                        //            trouble.TroubleCode = @"0000773";
                        //            trouble.TroubleType = TROUBLETYPE.WARN;
                        //            trouble.TroubleUnit = "试剂";
                        //            trouble.TroubleInfo = MyResources.Instance.FindResource("Parse0839").ToString() + p + MyResources.Instance.FindResource("Parse0832").ToString() + rgp.Assay + MyResources.Instance.FindResource("Parse08318").ToString();// string.Format("试剂位{0}项目{1}试剂2由于余量不足将锁定其对应的工作表. ", p, rgp.Assay);
                        //            TroubleLogSer.Save(trouble);
                        //        }
                        //        else
                        //        {
                        //            TroubleLog trouble = new TroubleLog();
                        //            trouble.TroubleCode = @"0000773";
                        //            trouble.TroubleType = TROUBLETYPE.ERR;
                        //            trouble.TroubleUnit = "试剂";
                        //            trouble.TroubleInfo = MyResources.Instance.FindResource("Parse0839").ToString() + p + MyResources.Instance.FindResource("Parse0832").ToString() + rgp.Assay + MyResources.Instance.FindResource("Parse08319").ToString();// string.Format("试剂位{0}项目{1}试剂2余量不足. ", p, rgp.Assay);
                        //            TroubleLogSer.Save(trouble);
                        //        }
                        //    }
                        //}
                        //else
                        //{
                        //if (RunSer.IsLockRgtEnable() == true)
                        //{
                        rsi.Locked = true;
                        myBatis.UpdateLockState("R2", rsi);

                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleCode = @"0000773";
                        trouble.TroubleType = TROUBLETYPE.WARN;
                        trouble.TroubleUnit = "试剂";
                        trouble.TroubleInfo = "试剂位" + p + "项目" + rgp.ProjectName + "试剂2余量不足将锁定其对应的工作表";    //string.Format("试剂位{0}项目{1}试剂2余量不足将锁定其对应的工作表. ", p, rgp.Assay);
                        myBatis.TroubleLogSave("TroubleLogSave", trouble);
                        //}
                        //else
                        //{
                        //    TroubleLog trouble = new TroubleLog();
                        //    trouble.TroubleCode = @"0000773";
                        //    trouble.TroubleType = TROUBLETYPE.ERR;
                        //    trouble.TroubleUnit = "试剂";
                        //    trouble.TroubleInfo = MyResources.Instance.FindResource("Parse0839").ToString() + p + MyResources.Instance.FindResource("Parse0832").ToString() + rgp.Assay + MyResources.Instance.FindResource("Parse08321").ToString();// string.Format("试剂位{0}项目{1}试剂2余量不足. ", p, rgp.Assay);
                        //    TroubleLogSer.Save(trouble);
                        //}
                        //}
                    }
                    if (c < rgtwarncount && c > rgtleastcount)
                    {
                        TroubleLog trouble = new TroubleLog();
                        trouble.TroubleCode = @"0000775";
                        trouble.TroubleType = TROUBLETYPE.WARN;
                        trouble.TroubleUnit = "试剂";
                        trouble.TroubleInfo = "试剂位" + p + "项目" + rgp.ProjectName + "试剂2余量即将耗尽";    // string.Format("试剂位{0}项目{1}:试剂2余量即将耗尽. ", p, rgp.Assay);
                        myBatis.TroubleLogSave("TroubleLogSave", trouble);
                        return;
                    }
                    break;
                }
            }
        }
Example #23
0
        /// <summary>
        /// 根据试剂条码信息获取对应的项目参数信息
        /// </summary>
        /// <param name="disk"></param>
        /// <param name="pos"></param>
        /// <param name="reagentBracode"></param>
        /// <returns></returns>
        public object GetRgBracodePara(int disk, string pos, string reagentBracode)
        {
            string b = Decode(reagentBracode);

            if (b == null)
            {
                string erinfo = "条码:" + reagentBracode + "解码失败";

                TroubleLog t = new TroubleLog();
                t.TroubleCode = "7777771";
                t.TroubleType = TROUBLETYPE.ERR;
                t.TroubleUnit = @"试剂条码";
                t.TroubleInfo = erinfo;
                //new ReagentState().TroubleLogSave().Save(t);
                mybatis.TroubleLogSave("TroubleLogSave", t);
                return("条码:" + reagentBracode + "不识别");
            }

            this.Disk     = disk;
            this.Position = pos;
            ReagentSettingsInfo newReagentSet = AnanlyeBarcode(b, reagentBracode);

            if (newReagentSet == null)
            {
                return("条码:" + reagentBracode + "不识别");
            }

            AssayProjectParamInfo a = mybatis.GetAssayProjectParamInfo(newReagentSet.ProjectName, newReagentSet.ReagentType) as AssayProjectParamInfo;

            if (a != null)
            {
                if (a.Reagent2VolSettings == 0 && newReagentSet.AssayParamType == "R2")
                {
                    string erinfo = "条码:" + reagentBracode + "不能装填。原因:参数试剂2体积为0,不能在该位置装填试剂2";

                    TroubleLog t = new TroubleLog();
                    t.TroubleCode = "7777771";
                    t.TroubleType = TROUBLETYPE.ERR;
                    t.TroubleUnit = @"试剂条码";
                    t.TroubleInfo = erinfo;
                    mybatis.TroubleLogSave("TroubleLogSave", t);

                    return("条码:" + reagentBracode + "装填失败");
                }
            }
            //检查该条码在试剂盘中是否存在
            ReagentSettingsInfo barrgtpos = mybatis.GetAssayALLReagentByBarcode(newReagentSet.Barcode);

            if (barrgtpos == null)
            {
                //newreagentPosition.AssayPara = "MR1";
            }
            else
            {
                this.RemoveOccupiedReagentInfo(barrgtpos);
                //newreagentPosition.AssayPara = barrgtpos.AssayPara;
            }
            ReagentSettingsInfo rgtpos = mybatis.GetAssayReagentByDisk(Disk, Position);

            if (rgtpos == null)
            {
            }
            else
            {
                this.RemoveOccupiedReagentInfo(rgtpos);
            }

            //List<CLItem> reagents = new RGTPOSManager().GetAssayALLReagent(newReagentSetInfo.Assay);
            //if (newReagentSetInfo.AssayPara == "R1")
            //{
            //    bool f1 = false;
            //    foreach (RGTPosition e in reagents)
            //    {
            //        if (e.AssayPara == "R1")
            //        {
            //            f1 = true;
            //            break;
            //        }
            //    }
            //    if (f1 == true)
            //    {
            //        newReagentSetInfo.AssayPara = "MR1";
            //    }
            //    else
            //    {
            //        newReagentSetInfo.AssayPara = "R1";
            //    }
            //}
            //if (newReagentSetInfo.AssayPara == "R2")
            //{
            //    bool f1 = false;
            //    foreach (RGTPosition e in reagents)
            //    {
            //        if (e.AssayPara == "R2")
            //        {
            //            f1 = true;
            //            break;
            //        }
            //    }
            //    if (f1 == true)
            //    {
            //        newReagentSetInfo.AssayPara = "MR2";
            //    }
            //    else
            //    {
            //        newReagentSetInfo.AssayPara = "R2";
            //    }
            //}

            //newReagentSetInfo.Disk = disk;
            newReagentSet.Pos = pos;

            //RGTPosition oldreagentPosition = new RGTPOSManager().Get(disk, pos);
            //if (oldreagentPosition != null)
            //{
            //    ReagentBarcode r = new ReagentBarcode();
            //    r.Barcode = oldreagentPosition.BarCode;
            //    r.ValidPercent = oldreagentPosition.ValidPercent;
            //    r.ExchangeDatetime = DateTime.Now;
            //    new ReagentBarcodeService().InsertReagentBarcode(r);
            //}

            ReagentBarcodeParam ReagentBarcode = mybatis.GetAllReagentBarParam(reagentBracode);

            if (ReagentBarcode == null)
            {
                if (disk == 1)
                {
                    newReagentSet.ValidPercent = 99;
                }
                else if (disk == 2)
                {
                    newReagentSet.ValidPercent2 = 99;
                }
            }
            else
            {
                if (disk == 1)
                {
                    newReagentSet.ValidPercent = ReagentBarcode.ValidPercent;
                }
                else if (disk == 2)
                {
                    newReagentSet.ValidPercent2 = ReagentBarcode.ValidPercent;
                }
            }

            mybatis.SaveReagentSettingInfo(disk, newReagentSet);
            new Task(new Action(() => { this.SaveOrUpReagentStateR1R2Info(newReagentSet); })).Start();

            TroubleLog t1 = new TroubleLog();

            t1.TroubleCode = "7777772";
            t1.TroubleType = TROUBLETYPE.WARN;
            t1.TroubleUnit = @"试剂条码";
            t1.TroubleInfo = "条码:" + reagentBracode + "加载成功";;
            mybatis.TroubleLogSave("TroubleLogSave", t1);

            return(null);
        }