/// <summary> /// 获取普通任务结果(每个比色杯43个点的反应进程结果) /// </summary> /// <param name="strMethodName"></param> /// <param name="sampleResInfo"></param> /// <returns></returns> public TimeCourseInfo QueryCommonTaskReaction(string strMethodName, SampleResultInfo sampleResInfo) { //string sampleResultTCNO = ""; TimeCourseInfo timeCourseInfoResult = null; try { //获取 TimeCourseTb 43个点进程数据 timeCourseInfoResult = ism_SqlMap.QueryForObject("PLCDataInfo." + strMethodName, string.Format("select * from TimeCourseTb where TimeCourseNO='{0}' and CONVERT(varchar(50),DrawDate, 120) like '%{1}%'", sampleResInfo.TCNO, sampleResInfo.SampleCreateTime.ToString("yyyy-MM-dd"))) as TimeCourseInfo; if (timeCourseInfoResult != null) { return(timeCourseInfoResult); } //如果上面没有获取到数据就去 timecourseBackUptb 获取43个点进程数据 timeCourseInfoResult = ism_SqlMap.QueryForObject("PLCDataInfo." + strMethodName, string.Format("select * from timecourseBackUptb where TimeCourseNO='{0}' and CONVERT(varchar(50),DrawDate, 120) like '%{1}%'", sampleResInfo.TCNO, sampleResInfo.SampleCreateTime.ToString("yyyy-MM-dd"))) as TimeCourseInfo; if (timeCourseInfoResult != null) { return(timeCourseInfoResult); } } catch (Exception e) { LogInfo.WriteErrorLog("QueryCommonTaskReaction(string strMethodName, SampleResultInfo sampleResInfo)==" + e.ToString(), Module.WorkingArea); } return(null); }
public void RunningErrors(int wn, string er) { RealTimeCUVDataInfo rt = myBatis.GetRealTimeCUVDataByWorkNo(wn); if (rt == null) { return; } switch (rt.WorkType) { case WORKTYPE.N: case WORKTYPE.E: SampleResultInfo samResInfo = myBatis.GetNORResult(rt); samResInfo.Remarks += "|" + er + "|"; myBatis.UpdateNORResultRunLog(samResInfo); break; case WORKTYPE.B: case WORKTYPE.S: CalibrationResultinfo calibResInfo = myBatis.QueryCalibResultInfoByTCNO(rt); calibResInfo.Remarks += "|" + er + "|"; myBatis.UpdateCalibResultRunLog(calibResInfo); break; case WORKTYPE.C: QualityControlResultInfo qcResInfo = myBatis.GetQCResult(rt); qcResInfo.Remarks += "|" + er + "|"; myBatis.UpdateQCResultRunLog(qcResInfo); break; } }
/// <summary> /// 修改样本结果已发送状态 /// </summary> public void UpdateSendSMPResultStatus(SampleResultInfo r) { try { string SQL = string.Format("update sampleresulttb set IsSend = '{0}' where TCNO = {1} and ProjectName = '{2}' and SampleNum = '{3}' and SampleType = '{4}' and DATEDIFF(dd,SampleCompletionTime,'{5}')=0", r.IsSend, r.TCNO, r.ProjectName, r.SampleNum, r.SampleType, r.SampleCompletionTime); ism_SqlMap.Update("CommonDataCheck.UpdateSMPResultInfo", SQL); } catch (Exception ex) { LogInfo.WriteErrorLog("UpdateSendSMPResultStatus(SampleResultInfo r) ==" + ex.ToString(), Module.LISSetting); } }
public bool GetResultBeExistFromRealTimeWorkNum(int workNo, out RealTimeCUVDataInfo rt) { bool bExist = false; rt = myBatis.GetRealTimeCUVDataByWorkNo(workNo); if (rt == null) { return(bExist); } switch (rt.WorkType) { case WORKTYPE.N: case WORKTYPE.E: SampleResultInfo samResInfo = myBatis.GetNORResult(rt); if (samResInfo == null) { bExist = false; } else { bExist = true; } break; case WORKTYPE.B: case WORKTYPE.S: CalibrationResultinfo calibResInfo = myBatis.QueryCalibResultInfoByTCNO(rt); if (calibResInfo == null) { bExist = false; } else { bExist = true; } break; case WORKTYPE.C: QualityControlResultInfo qcResInfo = myBatis.GetQCResult(rt); if (qcResInfo == null) { bExist = false; } else { bExist = true; } break; } return(bExist); }
/// <summary> /// 获取实时发送的样本结果数据 /// </summary> /// <returns></returns> public SampleResultInfo GetSampleResultInfo() { SampleResultInfo SampleResultInfo = null; try { SampleResultInfo = ism_SqlMap.QueryForObject("CommonDataCheck.GetActualTimeSampResult", string.Format("select top(1) * from sampleresulttb where IsSend = 'false' and SampleCompletionStatus = 2 order by SampleCreateTime")) as SampleResultInfo; } catch (Exception ex) { LogInfo.WriteErrorLog("GetSampleResultInfo() == " + ex.ToString(), Module.LISSetting); } return(SampleResultInfo); }
/// <summary> /// 反应监控 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnReactionCurve_Click(object sender, EventArgs e) { if (gridView1.SelectedRowsCount > 0) { reflectionMonitoring.LstSampleResInfo = lstSampleResInfo; int selectNum = gridView1.GetSelectedRows()[0]; SampleResultInfo sampleRes = new SampleResultInfo(); sampleRes.ProjectName = gridView1.GetRowCellValue(selectNum, "检测项目") as string; sampleRes.ConcResult = (float)System.Convert.ToDouble(gridView1.GetRowCellValue(selectNum, "检测结果")); sampleRes.SampleCompletionTime = System.Convert.ToDateTime(gridView1.GetRowCellValue(selectNum, "测试完成时间")); reflectionMonitoring.SampleResInfo = sampleRes; reflectionMonitoring.SampleInfoForRes = sampleInfo; reflectionMonitoring.StartPosition = FormStartPosition.CenterScreen; reflectionMonitoring.ShowDialog(); } }
public void UpdateNORResultRunLog(SampleResultInfo samResInfo) { try { Hashtable ht = new Hashtable(); ht.Add("SampleNum", samResInfo.SampleNum); ht.Add("ProjectName", samResInfo.ProjectName); ht.Add("TCNO", samResInfo.TCNO); ht.Add("Remarks", samResInfo.Remarks); ht.Add("SampleCreateTime", samResInfo.SampleCreateTime); ism_SqlMap.Update("WorkAreaApplyTask.UpdateNORResultRunLog", ht); } catch (Exception e) { LogInfo.WriteErrorLog("UpdateNORResultRunLog(SampleResultInfo samResInfo)==" + e.ToString(), Module.WorkingArea); } }
public string GetSampleTaskDilutionType(SampleResultInfo samResultInfo) { string dilutionType = string.Empty; try { Hashtable ht = new Hashtable(); ht.Add("SampleNum", samResultInfo.SampleNum); ht.Add("SampleCreateTime", samResultInfo.SampleCreateTime); ht.Add("ProjectName", samResultInfo.ProjectName); ht.Add("SampleType", samResultInfo.SampleType); dilutionType = ism_SqlMap.QueryForObject("WorkAreaApplyTask.GetSampleTaskDilutionType", ht) as string; } catch (Exception e) { LogInfo.WriteErrorLog("GetSampleTaskDilutionType(SampleResultInfo samResultInfo)==" + e.ToString(), Module.WorkingArea); } return(dilutionType); }
public TaskInfoForSamplePanelInfo QueryTaskInfoForSamplePanel(string strMethodName, string[] paramInfos) { // 1.获取样本编号、样本状态、样本类型 SampleInfo sampleInfo = myBatis.QuerySampleInfoByPosAndPanel("QuerySampleInfoByPosAndPanel", paramInfos); // 2.获取检测项目信息 List <SampleResultInfo> lstSampleResultInfo = new List <SampleResultInfo>(); lstSampleResultInfo = myBatis.QueryProjectResultBySampleNum(strMethodName, new string[] { sampleInfo.SampleNum.ToString(), sampleInfo.CreateTime.ToShortDateString() }); TaskInfoForSamplePanelInfo taskInfoForSamPanel = new TaskInfoForSamplePanelInfo(); taskInfoForSamPanel.SampleNum = sampleInfo.SampleNum; taskInfoForSamPanel.SampleState = sampleInfo.SampleState; taskInfoForSamPanel.SampleType = sampleInfo.SampleType; taskInfoForSamPanel.SamplePos = string.Format("{0}-{1}", sampleInfo.PanelNum, sampleInfo.SamplePos); List <SampleResultInfo> lstTaskResInfos = new List <SampleResultInfo>(); foreach (SampleResultInfo taskInfo in lstSampleResultInfo) { SampleResultInfo s = new SampleResultInfo(); s.ConcResult = taskInfo.ConcResult; s.ProjectName = taskInfo.ProjectName; Hashtable ht = new Hashtable(); ht.Add("SampleNum", taskInfo.SampleNum); ht.Add("DateTime", taskInfo.SampleCreateTime); ht.Add("ProjectName", taskInfo.ProjectName); ht.Add("SampleType", sampleInfo.SampleType); s.UnitAndRange = myBatis.QueryUnitAndRangeByProject("QueryUnitAndRangeByProject", ht); lstTaskResInfos.Add(s); } taskInfoForSamPanel.InspectInfos = XmlUtility.Serializer(typeof(List <SampleResultInfo>), lstTaskResInfos); return(taskInfoForSamPanel); }
/// <summary> /// 每完成一个任务就修改结果结果表吸光度值、浓度值、完成时间、完成状态 /// </summary> /// <param name="samResultInfo"></param> public void UpdateCurrentNORResult(SampleResultInfo samResultInfo) { try { Hashtable ht = new Hashtable(); //修改样本结果条件不需要这么多。 2018/9/3 //ht.Add("ProjectName", samResultInfo.ProjectName); //ht.Add("SampleType", samResultInfo.SampleType); ht.Add("TCNO", samResultInfo.TCNO); ht.Add("SampleCreateTime", samResultInfo.SampleCreateTime); //ht.Add("SampleNum", samResultInfo.SampleNum); ht.Add("AbsValue", samResultInfo.AbsValue); ht.Add("ConcResult", samResultInfo.ConcResult); ht.Add("SampleCompletionStatus", TaskState.SUCC); ht.Add("SampleCompletionTime", DateTime.Now.ToString()); ism_SqlMap.Update("WorkAreaApplyTask.UpdateCurrentNORResult", ht); } catch (Exception e) { LogInfo.WriteErrorLog("UpdateCurrentNORResult(SampleResultInfo samResultInfo)==" + e.ToString(), Module.WorkingArea); } }
public TimeCourseInfo QueryCommonTaskReaction(string strMethodName, SampleResultInfo sampleResInfo) { return(myBatis.QueryCommonTaskReaction(strMethodName, sampleResInfo)); }
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); } } } } }
private void RealTimeCalculate(RealTimeCUVDataInfo realTimeData) { SampleResultInfo norResult = null; switch (realTimeData.WorkType) { case WORKTYPE.N: case WORKTYPE.E: norResult = myBatis.GetNORResult(realTimeData) as SampleResultInfo; if (norResult != null) { if (resultService.IsResultRight(norResult.ToString()) == true) { norResult.AbsValue = resultService.GetResultAbsValue(norResult); float rc = resultService.GetResultConcValue(norResult); norResult.ConcResult = rc < 0 ? 0 : rc; } else { norResult.AbsValue = -1; norResult.ConcResult = -1; } //时时结果处理 myBatis.UpdateCurrentNORResult(norResult); // resultService.ProcessCurrentNormalResultCalValue(norResult); 针对计算项目,在前台计算 resultService.AnalyzeResult(norResult); //resultService.SetIntradayNorResultCalculated(true, norResult); } break; case WORKTYPE.B: case WORKTYPE.S: CalibrationResultinfo calibResInfo = myBatis.QueryCalibResultInfoByTCNO(realTimeData); //根据进程编号获取需要更新的校准结果记录 if (calibResInfo != null) { if (resultService.IsResultRight(calibResInfo.Remarks) == true) { calibResInfo.CalibAbs = resultService.GetResultAbsValue(calibResInfo); /*显示定标实际测量值 * AssayRunPara ar = new AssayRunParaService().Get(R.ItemName) as AssayRunPara; * if(ar!=null) * { * float k = (ar.SDTVol.VolPre+ar.SDTVol.VolDil)/ar.SDTVol.VolPre; * R.RAbsValue = (float.Parse(R.RAbsValue) * k).ToString("#0.0000"); * } * */ //R.RConcValue = resultService.GetResultConcValue(R).ToString("#0.0000"); } else { calibResInfo.CalibAbs = -1; // R.RConcValue = "NA"; } calibResInfo.TCNO = realTimeData.TC; myBatis.UpdateSDTTaskState(calibResInfo.SampleNum, calibResInfo.ProjectName, calibResInfo.CalibratorName, calibResInfo.CalibrationDT, TaskState.SUCC); resultService.OnSDTCalibrateCurve(calibResInfo); //resultService.SetSDTResultCalculated(true, R); } break; case WORKTYPE.C: QualityControlResultInfo qCResInfo = myBatis.GetQCResult(realTimeData); if (qCResInfo != null) { if (resultService.IsResultRight(qCResInfo.Remarks) == true) { qCResInfo.AbsValue = resultService.GetResultAbsValue(qCResInfo); qCResInfo.ConcResult = resultService.GetResultConcValue(qCResInfo); } else { qCResInfo.AbsValue = -1; qCResInfo.ConcResult = -1; } myBatis.UpdateQCResult(qCResInfo); //resultService.SetQCResultCalculated(true, R); } break; } }