//获取前驱界限 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); }
//试剂吸光度 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); }
//底物吸光度 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); }
/// <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); }
/// <summary> /// 反应进程编号(下拉框改变事件) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBoxEditCuveNum_SelectedIndexChanged(object sender, EventArgs e) { //根据下拉框选择的比色表编号更新对应的校准信息 //TimeCourseInfo timecuvno = new TimeCourseInfo(); int tcno = 0; string strCalibrationDT = ""; int TestNum = 0; foreach (CalibrationResultinfo calib in lstCalibrationResultInfo) { if (comboBoxCalibTime.Text == calib.CalibrationDT.ToString() && comBoxEditCalibName.Text == calib.CalibratorName) { TestNum++; } if (comBoxEditCalibName.Text == calib.CalibratorName && Convert.ToInt32(comBoxProcessNumValue.Text) == calib.TCNO && comboBoxCalibTime.Text == calib.CalibrationDT.ToString()) { tcno = calib.TCNO; strCalibrationDT = calib.CalibrationDT.ToString("yyyy-MM-dd"); } } comboBoxNum.Text = TestNum.ToString(); this.comBoxEditCalibName.Enabled = false; this.comboBoxCalibTime.Enabled = false; this.comBoxProcessNumValue.Enabled = false; //if (CalibrationTimeCoursetEvent != null) //{ // CalibrationTimeCoursetEvent(new Dictionary<string, object[]>() { { "QueryCalibrationReactionProcess", new object[] { XmlUtility.Serializer(typeof(TimeCourseInfo), timecuvno) } } }); //} TimeCourseInfo timeCourseInfoResult = new Calibrator().QueryCalibrationReactionProcess("QueryCalibrationReactionProcess", tcno, strCalibrationDT); this.SampleReactionInfo = timeCourseInfoResult; }
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); }
//速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)); }
//建立吸光度与时间关系 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; } }
public void DataTransfer_Event(string strMethod, object sender) { switch (strMethod) { case "QueryCalibrationState": List <CalibrationResultinfo> calibratorinfo = (List <CalibrationResultinfo>)XmlUtility.Deserialize(typeof(List <CalibrationResultinfo>), sender as string); AddCalibrationState(calibratorinfo); break; case "QueryCalibrationResultinfo": Resultinfo = (List <CalibrationResultinfo>)XmlUtility.Deserialize(typeof(List <CalibrationResultinfo>), sender as string); // AddCalibrationState(Resultinfo); calibrationTrace.CalibrationResultinfoAdd(Resultinfo); break; case "QueryCalibrationCurveInfo": calibrationCurveInfo = (List <SDTTableItem>)XmlUtility.Deserialize(typeof(List <SDTTableItem>), sender as string); calibrationCurve.SelectedlistCalibrationCurve(calibrationCurveInfo); break; case "SaveSDTTableItem": string str = sender as string; if (str == "校准曲线保存成功!") { calibrationCurve.StrResult = str; } else { calibrationCurve.StrResult = str; } break; case "QuerysDTTableItem": List <SDTTableItem> lisSDTTableItem = (List <SDTTableItem>)XmlUtility.Deserialize(typeof(List <SDTTableItem>), sender as string); //form1.sDTTableItem = lisSDTTableItem; //form1.add(lisSDTTableItem); break; case "QueryCalibrationReactionProcess": TimeCourseInfo calibrationReactionProcess = (TimeCourseInfo)XmlUtility.Deserialize(typeof(TimeCourseInfo), sender as string); if (calibrationReactionProcess != null) { reactionProcessCB.SampleReactionInfo = calibrationReactionProcess; //reactionProcessCB.Add(calibrationReactionProcess[0]); } break; case "QueryCalibrationResultInfoAndTimeCUVNO": List <CalibrationResultinfo> lstCalibrationResultInfoAndTimeCUVNO = (List <CalibrationResultinfo>)XmlUtility.Deserialize(typeof(List <CalibrationResultinfo>), sender as string); reactionProcessCB.calibrationResultInfoAndTimeCUVNOAdd(lstCalibrationResultInfoAndTimeCUVNO); break; } }
//一点法 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)); }
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); }
private void loadReflectionMonitoring() { CUVNO.Visible = false; txtSampleNum.Text = sampleInfoForRes.SampleNum.ToString(); dtpApplyTime.Value = sampleResInfo.SampleCreateTime; txtSampleName.Text = sampleResInfo.ProjectName; txtConcResult.Text = sampleResInfo.ConcResult.ToString(); chartReaction.Series.Clear(); string taskState = string.Empty; switch (sampleResInfo.SampleCompletionStatus) { case 0: taskState = "异常"; break; case 1: taskState = "检测中"; break; case 2: taskState = "已完成"; break; } txtProjectState.Text = taskState; if (bAudit) { TimeCourseInfo timeCourseInfoResult = new WorkingAreaDataCheck().QueryCommonTaskReaction("QueryTimeCourse", sampleResInfo); this.SampleReactionInfo = timeCourseInfoResult; } else { TimeCourseInfo timeCourseInfoResult = new WorkingAreaDataCheck().QueryCommonTaskReaction("QueryTimeCourse", sampleResInfo); this.SampleReactionInfo = timeCourseInfoResult; } }
//二点法 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); }
//获取每个吸光度读数点 //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); }
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); } } } } }
/// <summary> /// 接收数据库数据传输 /// </summary> /// <param name="strMethod"></param> /// <param name="sender"></param> public void DataTransfer_Event(string strMethod, object sender) { switch (strMethod) { case "QueryQCResultInfo": InitialQCResultInfos(XmlUtility.Deserialize(typeof(List <QCResultForUIInfo>), sender as string) as List <QCResultForUIInfo>); break; case "QueryQCInfosForAddQCResult": frmEditQCRes.QCInfos = (List <QualityControlInfo>)XmlUtility.Deserialize(typeof(List <QualityControlInfo>), sender as string); break; case "QueryProjectName": List <string> lstProjectNames = (List <string>)XmlUtility.Deserialize(typeof(List <string>), sender as string); this.Invoke(new EventHandler(delegate { txtProjectName.Properties.Items.Clear(); txtProjectName.Properties.Items.AddRange(lstProjectNames); })); break; case "GetsQCRelationProInfo": lstQCRelationProjects = (List <QCRelationProjectInfo>)XmlUtility.Deserialize(typeof(List <QCRelationProjectInfo>), sender as string); break; case "QueryQCAllInfo": lstQCInfo = (List <QualityControlInfo>)XmlUtility.Deserialize(typeof(List <QualityControlInfo>), sender as string); break; case "EditQCResultForManual": if ((sender as string) == "添加成功!") { this.Invoke(new EventHandler(delegate { this.frmEditQCRes.Close(); })); //CommunicationUI.ServiceClient.ClientSendMsgToService(ModuleInfo.QCResult, XmlUtility.Serializer(typeof(CommunicationEntity), new CommunicationEntity("QueryQCResultInfo", XmlUtility.Serializer(typeof(QCResultForUIInfo), new QCResultForUIInfo() { QCTimeStartTS = dtpQCStartTime.Value, QCTimeEndTS = dtpQCEndTime.Value })))); qcStateDic.Clear(); qcStateDic.Add("QueryQCResultInfo", new object[] { XmlUtility.Serializer(typeof(QCResultForUIInfo), new QCResultForUIInfo() { QCTimeStartTS = dtpQCStartTime.Value, QCTimeEndTS = dtpQCEndTime.Value }) }); ClientSendToServices(qcStateDic); } break; case "AddQCResultForManual": if ((sender as string) == "添加成功!") { this.Invoke(new EventHandler(delegate { this.frmEditQCRes.Close(); })); qcStateDic.Clear(); qcStateDic.Add("QueryQCResultInfo", new object[] { XmlUtility.Serializer(typeof(QCResultForUIInfo), new QCResultForUIInfo() { QCTimeStartTS = dtpQCStartTime.Value, QCTimeEndTS = dtpQCEndTime.Value }) }); ClientSendToServices(qcStateDic); } else { this.frmEditQCRes.StrReceiveInfo = sender as string; } break; case "DeleteQCResult": if ((sender as string) == "删除成功!") { this.Invoke(new EventHandler(delegate { this.frmEditQCRes.Close(); })); qcStateDic.Clear(); qcStateDic.Add("QueryQCResultInfo", new object[] { XmlUtility.Serializer(typeof(QCResultForUIInfo), new QCResultForUIInfo()) }); ClientSendToServices(qcStateDic); } else { this.frmEditQCRes.StrReceiveInfo = "删除失败!"; } break; case "QueryTimeCourseByQCInfo": TimeCourseInfo qcTimeCourse = (TimeCourseInfo)XmlUtility.Deserialize(typeof(TimeCourseInfo), sender as string); reactionProcessQC.QCReactionInfo = qcTimeCourse; break; default: break; } }