示例#1
0
        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;
            }
        }