Esempio n. 1
0
        /// <summary>
        /// 下移按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simButShiftDown_Click(object sender, EventArgs e)
        {
            bool b = true;

            index = gridView1.GetSelectedRows()[0];
            if (index >= lstProjectNames.Count - 1 || index < 0)
            {
                return;
            }
            int cur = index;
            ProjectRunSequenceInfo projectName = this.lstProjectNames.ElementAt(cur);

            this.lstProjectNames.RemoveAt(cur);
            this.lstProjectNames.Insert(cur + 1, projectName);
            ShowProjectSequence(lstProjectNames);
            this.RecordFocus(b);
        }
Esempio n. 2
0
        /// <summary>
        /// 保存项目测试顺序信息
        /// </summary>
        /// <param name="strDBMethod"></param>
        /// <param name="lstProSunSequence"></param>
        public string SaveProjectRunSequenceInfo(string strDBMethod, List <ProjectRunSequenceInfo> lstProSunSequence)
        {
            ProjectRunSequenceInfo projectRunSequ = new ProjectRunSequenceInfo();
            int resultCount = 0;

            for (int i = 0; i < lstProSunSequence.Count; i++)
            {
                projectRunSequ.ProjectName = lstProSunSequence[i].ProjectName;
                projectRunSequ.SampleType  = lstProSunSequence[i].SampleType;
                projectRunSequ.RunSequence = i + 1;
                resultCount += myBatis.SaveProjectRunSequenceInfo(strDBMethod, projectRunSequ);
            }
            if (resultCount == lstProSunSequence.Count)
            {
                return("调整项目测试顺序保存成功!");
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
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);
                        }
                    }
                }
            }
        }