public void RetestBatch() { try { CBatchFactory faBatch = new CBatchFactory(); CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch)); // --- check parity for (int i = 0; i < ListSamples.Count; i++) { CBatch_detail_aa_twofold row = ListSamples[i]; CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory(); if (Convert.ToInt32(row.Flag_mri) == 0) { // --- approved samples with additional retest mark row.Qaqc_has_retest = 1; faBatch_detail_aa_twofold.Update(row); // --- save retest string cod_type_sample = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(Convert.ToInt32(row.Idtemplate_method))).Cod_type_sample; CCorrelative oCorrelative = new CCorrelativeFactory().GetByPrimaryKey(new CCorrelativeKeys(cod_type_sample)); CBatchManager oBatchManager = new CBatchManager(); oBatchManager.CallSaveFromRetestFullBatch( Convert.ToInt32(row.Idtemplate_method), Convert.ToInt64(row.Idrecep_sample), Convert.ToInt64(row.Idrecep_sample_detail), Convert.ToInt64(row.Idrecep_sample_detail_elem), Convert.ToInt64(row.Cod_interno), row.Cod_sample, Comun.GetUser(), oCorrelative, row.Qaqc_par); // --- register as finished trace process CProcess_Sample_Manage.Finalize_process(Convert.ToInt64(row.Idrecep_sample_detail_elem), LimsProcess.PROCESS_IN_READING, LimsProcess.PROCESS_APPROVE_SAMPLES); } } // --- modify the batch status, put in other process CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(LimsProcess.PROCESS_APPROVE_SAMPLES)); oBatch.Status_process = Convert.ToChar(LimsProcess.Status_Process.Waiting); oBatch.Cod_module = oProcess.Cod_module; oBatch.Cod_area = oProcess.Cod_area; oBatch.Cod_process = LimsProcess.PROCESS_APPROVE_SAMPLES; oBatch.User_approve_tray = Comun.GetUser(); oBatch.Date_approve_tray = Comun.GetDate(); faBatch.Update(oBatch); // --- register as finished trace batch Cprocess_Batch_Manage.Finalize_process(Idbatch, LimsProcess.PROCESS_IN_READING, LimsProcess.PROCESS_APPROVE_SAMPLES); } catch (Exception ex) { Comun.Save_log(ex.InnerException.ToString()); throw new Exception("pivot data::approve::Error occured.", ex); } }
void Show_batch() { // --- show trace groups gbApprove.Visible = false; gbReview.Visible = false; gv2col_Qaqc_approve.ImageIndex = 0; gv2col_Qaqc_review.ImageIndex = 0; // --- show template method ShowDilution(); // --- show description method CBatchFactory faBatch = new CBatchFactory(); CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch)); laTitleModule.Text = String.Format("Bandeja {0} en Espera", Comun.FormatCorrelativeCode("B-", Convert.ToInt64(oBatch.Num_tray), 5)); if (oBatch.Status_process == 'W') { ucSignCloseTray.Title = "Cerrar bandeja"; ucSignCloseTray.Enabled = true; bgvBatchCalc2.OptionsBehavior.Editable = false; } if (oBatch.Status_process == 'P') { ucSignCloseTray.Title = "Cerrado("+oBatch.User_close_tray+")"; ucSignCloseTray.Enabled = false; bgvBatchCalc2.OptionsBehavior.Editable = true; } CTemplate_methodFactory faTemplate_method = new CTemplate_methodFactory(); oTemplate_method_current = faTemplate_method.GetByPrimaryKey(new CTemplate_methodKeys(Idtemplate_method)); tbCodMethod.Text = oTemplate_method_current.Cod_template_method; tbTitle.Text = oTemplate_method_current.Title; tbAbbreviation.Text = oTemplate_method_current.Abbreviation; #region <optimizar> CTemplate_method_aaFactory faTemplate_method_aa = new CTemplate_method_aaFactory(); oTemplate_method_aa_current = faTemplate_method_aa.GetByPrimaryKey(new CTemplate_method_aaKeys(Idtemplate_method)); deDate_allowed_error.DateTime = Convert.ToDateTime(oTemplate_method_aa_current.Date_allowed_error); CMr_detailFactory faMr_detail = new CMr_detailFactory(); CMr_detail oMr_detail = faMr_detail.GetByPrimaryKey(new CMr_detailKeys(Convert.ToInt16(oTemplate_method_aa_current.Idmr_detail))); tbLawMri.Text = oMr_detail.Nominal_value.ToString(); CMrFactory faMr = new CMrFactory(); CMr oMr = faMr.GetByPrimaryKey(new CMrKeys( Convert.ToInt16(oMr_detail.Idmr) )); tbMri.Text = oMr.Cod_mr; CMeasurement_unitFactory faMeasure = new CMeasurement_unitFactory(); CMeasurement_unit oMeasurement_unit = faMeasure.GetByPrimaryKey(new CMeasurement_unitKeys(Convert.ToInt16(oMr_detail.Idunit1))); tbUnitMeasure.Text = oMeasurement_unit.Name_unit; #endregion // --- clear columns gcBachCalc.DataSource = null; // --- format the datatable with the number of repetitions oDataBatch = new CDataBatch(Idbatch, Idtemplate_method, Comun.StatusWork.Waiting, Comun.CriteriaSort.BySample); gcBachCalc.DataSource = oDataBatch.ListSamples; // --- show sd tbAbs.Value = oDataBatch.Absorbance; tbStd.Value = oDataBatch.StdVerification; tbAbs.BackColor = oDataBatch.ColorAbsorbance; tbStd.BackColor = oDataBatch.ColorStd; tbSdBlk.Text = oDataBatch.LrbMeasured.ToString(); tbSdBlk.BackColor = oDataBatch.ColorLrbMeasured; tbSdMr.Text = oDataBatch.MriMeasured.ToString(); tbSdMr.BackColor = oDataBatch.ColorMriMeasured; // --- show empty sample ShowParityEmptySample(false); }
void Show_batch_finished() { gbApprove.Visible = true; gbReview.Visible = true; gv2col_Qaqc_approve.ImageIndex = 0; gv2col_Qaqc_review.ImageIndex = 0; // --- show template method ShowDilution(); // --- show description method CTemplate_methodFactory faTemplate_method = new CTemplate_methodFactory(); CTemplate_method oTemplate_method = faTemplate_method.GetByPrimaryKey(new CTemplate_methodKeys(Idtemplate_method)); tbCodMethod.Text = oTemplate_method.Cod_template_method; tbTitle.Text = oTemplate_method.Title; tbAbbreviation.Text = oTemplate_method.Abbreviation; // --- get batch trace_batch CTrace_batchFactory faTrace_batch = new CTrace_batchFactory(); Dictionary<string, string> dtTrace_batch = new BusinessLayer.Modules.ModProcessBatch().GetCurrentAndBelow(Idbatch, LimsProcess.PROCESS_IN_READING); CBatchFactory faBatch = new CBatchFactory(); CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch)); laTitleModule.Text = String.Format("Bandeja {0} Aprobada\n ({1})" , "B-" + oBatch.Num_tray.ToString().PadLeft(5, '0') , dtTrace_batch["User_approved"].ToString()); laUser_approved.Text = dtTrace_batch["User_approved"].ToString(); laDate_approved.Text = dtTrace_batch["Date_approved"].ToString(); laUser_revised.Text = dtTrace_batch["User_revised"].ToString(); laDate_revised.Text = dtTrace_batch["Date_revised"].ToString(); #region <optimizar> CTemplate_method_aaFactory faTemplate_method_aa = new CTemplate_method_aaFactory(); CTemplate_method_aa oTemplate_method_aa = faTemplate_method_aa.GetByPrimaryKey(new CTemplate_method_aaKeys(Idtemplate_method)); deDate_allowed_error.DateTime = Convert.ToDateTime(oTemplate_method_aa.Date_allowed_error); CMr_detailFactory faMr_detail = new CMr_detailFactory(); CMr_detail oMr_detail = faMr_detail.GetByPrimaryKey(new CMr_detailKeys(Convert.ToInt16(oTemplate_method_aa.Idmr_detail))); tbLawMri.Text = oMr_detail.Nominal_value.ToString(); CMrFactory faMr = new CMrFactory(); CMr oMr = faMr.GetByPrimaryKey(new CMrKeys( Convert.ToInt16(oMr_detail.Idmr) )); tbMri.Text = oMr.Cod_mr; CMeasurement_unitFactory faMeasure = new CMeasurement_unitFactory(); CMeasurement_unit oMeasurement_unit = faMeasure.GetByPrimaryKey(new CMeasurement_unitKeys(Convert.ToInt16(oMr_detail.Idunit1))); tbUnitMeasure.Text = oMeasurement_unit.Name_unit; #endregion // --- clear columns gcBachCalc.DataSource = null; // --- format the datatable with the number of repetitions if (cbAuthorizationApproved.EditValue.ToString() == "0000") oDataBatch = new CDataBatch(Idbatch, Idtemplate_method, Comun.StatusWork.Saved, Comun.CriteriaSort.BySample); else oDataBatch = new CDataBatch(Idbatch, Idtemplate_method, Comun.StatusWork.Management, Comun.CriteriaSort.BySample); gcBachCalc.DataSource = oDataBatch.ListSamples; // --- show sd tbAbs.Value = oDataBatch.Absorbance; tbStd.Value = oDataBatch.StdVerification; tbAbs.BackColor = oDataBatch.ColorAbsorbance; tbStd.BackColor = oDataBatch.ColorStd; tbSdBlk.Text = oDataBatch.LrbMeasured.ToString(); tbSdBlk.BackColor = oDataBatch.ColorLrbMeasured; tbSdMr.Text = oDataBatch.MriMeasured.ToString(); tbSdMr.BackColor = oDataBatch.ColorMriMeasured; // --- OPTIMIZAR A USER CONTROL paAuthorization.Visible = true; // --- show empty sample ShowParityEmptySample(true); }
public void ApplyQaqcMrBlk(CBatch_detail_aa_twofold current_row) { int flag_mri = Convert.ToInt32(current_row.Flag_mri); // only work with rows that are reference material if (flag_mri == 1) { long idbatch = Convert.ToInt64(pivot[0].Idbatch); CBatchFactory faBatch = new CBatchFactory(); CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(idbatch)); GetSd(); // recuperate the blk decimal value_blk = Convert.ToDecimal(current_row.Reading1); // blk if (current_row.Reading1 != null) { if (value_blk <= Max_value_blk) { current_row.Qaqc_blk = 1; // --- correcto oBatch.Flag_correct_lrb = true; oBatch.Lrb_measured = Convert.ToDecimal(Lrb_measured); } if (value_blk > Max_value_blk) { current_row.Qaqc_blk = 2; // --- error en el blanco oBatch.Flag_correct_lrb = false; oBatch.Lrb_measured = Convert.ToDecimal(Lrb_measured); } } // mri if (current_row.Reading2 != null) { // ley mri +- repetibilidad*2 <= ley conocida + reproducibilidad decimal min = Law_fixed - Factor_reproducibility; decimal max = Law_fixed + Factor_reproducibility; decimal law_mr = Convert.ToDecimal(current_row.Law2); decimal value = law_mr; if (value >= min && value <= max) { current_row.Qaqc_mr = 1; // correcto oBatch.Flag_correct_mri = true; oBatch.Mri_measured = Convert.ToDecimal(Mri_measured); } if (value < min || value > max) { current_row.Qaqc_mr = 2; // error en el mri oBatch.Flag_correct_mri = false; oBatch.Mri_measured = Convert.ToDecimal(Mri_measured); } } faBatch.Update(oBatch); } else { // no es mri current_row.Qaqc_blk = 3; current_row.Qaqc_mr = 3; } }
public void Review() { try { CBatchFactory faBatch = new CBatchFactory(); CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch)); // --- save trace CRecep_sample_detail_elemFactory faRecep_sample_detail_elem = new CRecep_sample_detail_elemFactory(); for (int i = 0; i < ListSamples.Count; i++) { CBatch_detail_aa_twofold current_row = ListSamples[i]; int status_result = Convert.ToInt32(current_row.Qaqc_status_result); if (Convert.ToInt32(current_row.Flag_mri) == 0) { // --- set how accepted sample // Espera = 0, // Incorrecto = 1, // Plausible = 2, // Aceptado = 3, // IncorrectoPlausible = 4, // Espera reensayos = 5 // --- save only the accept samples long Idrecep_sample_detail_elem = Convert.ToInt64(current_row.Idrecep_sample_detail_elem); if (Convert.ToBoolean(oBatch.Flag_correct_mri) && Convert.ToBoolean(oBatch.Flag_correct_lrb)) { if (status_result == Convert.ToInt32(Comun.Status_result.Plausible)) { current_row.Qaqc_status_result = Convert.ToInt16(Comun.Status_result.Aceptado); } Qaqc oQaqc = new Qaqc(); if (!oQaqc.IsRetest(Idrecep_sample_detail_elem, Idbatch)) { // --- save final element law if (current_row.Qaqc_status_result == Convert.ToInt16(Comun.Status_result.Aceptado)) { CRecep_sample_detail_elem oRecep_sample_detail_elem = faRecep_sample_detail_elem.GetByPrimaryKey(new CRecep_sample_detail_elemKeys(Idrecep_sample_detail_elem)); oRecep_sample_detail_elem.Result_analysis = current_row.Result_analysis; oRecep_sample_detail_elem.Str_result_analysis = current_row.Str_result_analysis.ToString(); oRecep_sample_detail_elem.With_result = true; if (current_row.Str_result_analysis == null) { oRecep_sample_detail_elem.With_result = false; } faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem); } CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory(); faBatch_detail_aa_twofold.Update(current_row); } else// --- es un reensayo { if (!oQaqc.ExistsResultPendingSel(Idrecep_sample_detail_elem, Idbatch)) { // --- si no está pendiente de seleccionar entre varios análisis // --- save final element law if (current_row.Qaqc_status_result == Convert.ToInt16(Comun.Status_result.Aceptado)) { CRecep_sample_detail_elem oRecep_sample_detail_elem = faRecep_sample_detail_elem.GetByPrimaryKey(new CRecep_sample_detail_elemKeys(Idrecep_sample_detail_elem)); oRecep_sample_detail_elem.Result_analysis = current_row.Result_analysis; oRecep_sample_detail_elem.Str_result_analysis = current_row.Str_result_analysis.ToString(); oRecep_sample_detail_elem.With_result = true; if (current_row.Str_result_analysis == null) { oRecep_sample_detail_elem.With_result = false; } faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem); } CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory(); faBatch_detail_aa_twofold.Update(current_row); } } // --- save retest if (current_row.Qaqc_tmp_retest == 1) { string cod_type_sample = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(Convert.ToInt32(current_row.Idtemplate_method))).Cod_type_sample; CCorrelative oCorrelative = new CCorrelativeFactory().GetByPrimaryKey(new CCorrelativeKeys(cod_type_sample)); CBatchManager oBatchManager = new CBatchManager(); oBatchManager.CallSaveSampleBatchWithRetest( Convert.ToInt32(current_row.Idtemplate_method), Convert.ToInt64(current_row.Idrecep_sample), Convert.ToInt64(current_row.Idrecep_sample_detail), Convert.ToInt64(current_row.Idrecep_sample_detail_elem), Convert.ToInt64(current_row.Cod_interno), current_row.Cod_sample, Comun.GetUser(), oCorrelative, Convert.ToInt32(current_row.Qaqc_par), Idbatch); } // --- register as finished trace process CProcess_Sample_Manage.Finalize_process(Idrecep_sample_detail_elem, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS); } else { // --- the samples pertain to batch with full batch retest CProcess_Sample_Manage.Finalize_process(Idrecep_sample_detail_elem, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS); } } } // --- modify the batch status, put in other process CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(LimsProcess.PROCESS_ACCEPT_RESULTS)); oBatch.Status_process = Convert.ToChar(LimsProcess.Status_Process.Waiting); oBatch.Cod_module = oProcess.Cod_module; oBatch.Cod_area = oProcess.Cod_area; oBatch.Cod_process = LimsProcess.PROCESS_ACCEPT_RESULTS; oBatch.User_review_tray = Comun.GetUser(); oBatch.Date_review_tray = Comun.GetDate(); faBatch.Update(oBatch); // --- register as finished trace batch Cprocess_Batch_Manage.Finalize_process(Idbatch, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS); } catch (Exception ex) { Comun.Save_log(ex.InnerException.ToString()); throw new Exception("pivot data::approve::Error occured.", ex); } }
public void Review() { try { CBatchFactory faBatch = new CBatchFactory(); CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch)); // --- save trace CRecep_sample_detail_elemFactory faRecep_sample_detail_elem = new CRecep_sample_detail_elemFactory(); for (int i = 0; i < ListSamples.Count; i++) { CBatch_detail_aa_twofold current_row = ListSamples[i]; int status_result = Convert.ToInt32(current_row.Qaqc_status_result); if (Convert.ToInt32(current_row.Flag_mri) == 0) { // --- set how accepted sample // Espera = 0, // Incorrecto = 1, // Plausible = 2, // Aceptado = 3, // IncorrectoPlausible = 4, // Espera reensayos = 5 // --- save only the accept samples long Idrecep_sample_detail_elem = Convert.ToInt64(current_row.Idrecep_sample_detail_elem); if (Convert.ToBoolean(oBatch.Flag_correct_mri) && Convert.ToBoolean(oBatch.Flag_correct_lrb)) { if (status_result == Convert.ToInt32(Comun.Status_result.Plausible)) current_row.Qaqc_status_result = Convert.ToInt16(Comun.Status_result.Aceptado); Qaqc oQaqc = new Qaqc(); if (!oQaqc.IsRetest(Idrecep_sample_detail_elem, Idbatch)) { // --- save final element law if (current_row.Qaqc_status_result == Convert.ToInt16(Comun.Status_result.Aceptado)) { CRecep_sample_detail_elem oRecep_sample_detail_elem = faRecep_sample_detail_elem.GetByPrimaryKey(new CRecep_sample_detail_elemKeys(Idrecep_sample_detail_elem)); oRecep_sample_detail_elem.Result_analysis = current_row.Result_analysis; oRecep_sample_detail_elem.Str_result_analysis = current_row.Str_result_analysis.ToString(); oRecep_sample_detail_elem.With_result = true; if (current_row.Str_result_analysis == null) oRecep_sample_detail_elem.With_result = false; faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem); } CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory(); faBatch_detail_aa_twofold.Update(current_row); } else// --- es un reensayo { if (!oQaqc.ExistsResultPendingSel(Idrecep_sample_detail_elem, Idbatch)) { // --- si no está pendiente de seleccionar entre varios análisis // --- save final element law if (current_row.Qaqc_status_result == Convert.ToInt16(Comun.Status_result.Aceptado)) { CRecep_sample_detail_elem oRecep_sample_detail_elem = faRecep_sample_detail_elem.GetByPrimaryKey(new CRecep_sample_detail_elemKeys(Idrecep_sample_detail_elem)); oRecep_sample_detail_elem.Result_analysis = current_row.Result_analysis; oRecep_sample_detail_elem.Str_result_analysis = current_row.Str_result_analysis.ToString(); oRecep_sample_detail_elem.With_result = true; if (current_row.Str_result_analysis == null) oRecep_sample_detail_elem.With_result = false; faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem); } CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory(); faBatch_detail_aa_twofold.Update(current_row); } } // --- save retest if (current_row.Qaqc_tmp_retest == 1) { string cod_type_sample = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(Convert.ToInt32(current_row.Idtemplate_method))).Cod_type_sample; CCorrelative oCorrelative = new CCorrelativeFactory().GetByPrimaryKey(new CCorrelativeKeys(cod_type_sample)); CBatchManager oBatchManager = new CBatchManager(); oBatchManager.CallSaveSampleBatchWithRetest( Convert.ToInt32(current_row.Idtemplate_method), Convert.ToInt64(current_row.Idrecep_sample), Convert.ToInt64(current_row.Idrecep_sample_detail), Convert.ToInt64(current_row.Idrecep_sample_detail_elem), Convert.ToInt64(current_row.Cod_interno), current_row.Cod_sample, Comun.GetUser(), oCorrelative, Convert.ToInt32(current_row.Qaqc_par), Idbatch); } // --- register as finished trace process CProcess_Sample_Manage.Finalize_process(Idrecep_sample_detail_elem, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS); } else { // --- the samples pertain to batch with full batch retest CProcess_Sample_Manage.Finalize_process(Idrecep_sample_detail_elem, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS); } } } // --- modify the batch status, put in other process CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(LimsProcess.PROCESS_ACCEPT_RESULTS)); oBatch.Status_process = Convert.ToChar(LimsProcess.Status_Process.Waiting); oBatch.Cod_module = oProcess.Cod_module; oBatch.Cod_area = oProcess.Cod_area; oBatch.Cod_process = LimsProcess.PROCESS_ACCEPT_RESULTS; oBatch.User_review_tray = Comun.GetUser(); oBatch.Date_review_tray = Comun.GetDate(); faBatch.Update(oBatch); // --- register as finished trace batch Cprocess_Batch_Manage.Finalize_process(Idbatch, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS); } catch (Exception ex) { Comun.Save_log(ex.InnerException.ToString()); throw new Exception("pivot data::approve::Error occured.", ex); } }