public long m_lngUpdateQCData(clsLisQCDataVO QCBatch) { using (clsTmdQCBatchSvc svc = new clsTmdQCBatchSvc()) { return(svc.m_lngUpdateQCData(this.objPrincipal, QCBatch)); } }
public long m_lngUpdate(System.Security.Principal.IPrincipal p_objPrincipal, clsLisQCDataVO QCBatch) { long lngRes = 0; clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, m_strCurrentSvcDetailName, "m_lngUpdate"); if (lngRes <= 0) { return(-1); } com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); try { System.Data.IDataParameter[] objODPArr = GetUpdateDataParameterArr(QCBatch); long lngRecEff = -1; //往表增加记录 lngRes = 0; lngRes = objHRPSvc.lngExecuteParameterSQL(m_strUpdateSql, ref lngRecEff, objODPArr); objHRPSvc.Dispose(); } catch (Exception objEx) { new clsLogText().LogError(objEx); } return(lngRes); }
internal long m_lngInsertQCData(clsLisQCDataVO p_objQCData, out int p_intSeq) { using (clsTmdQCBatchSvc svc = new clsTmdQCBatchSvc()) { return(svc.m_lngInsertQCData(this.objPrincipal, p_objQCData, out p_intSeq)); } }
public long m_lngFind(System.Security.Principal.IPrincipal p_objPrincipal, int p_intSeq, out clsLisQCDataVO p_objQCData) { long lngRes = 0; p_objQCData = null; clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.LIS.clsTmdQCBatchConcentrationSvc", "m_lngFind"); if (lngRes <= 0) { return(-1); } com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); try { System.Data.IDataParameter[] objODPArr = clsPublicSvc.m_objConstructIDataParameterArr(p_intSeq); DataTable dtbResult = null; lngRes = 0; lngRes = objHRPSvc.lngGetDataTableWithParameters(m_strFindSql, ref dtbResult, objODPArr); objHRPSvc.Dispose(); if (lngRes == 1 && dtbResult != null && dtbResult.Rows.Count > 0) { p_objQCData = new clsLisQCDataVO(); this.ConstructVO(dtbResult.Rows[0], ref p_objQCData); } } catch (Exception objEx) { new clsLogText().LogError(objEx); } return(lngRes); }
private void m_cmdDeleteRow_Click(object sender, EventArgs e) { DataGridViewRow viewRow = m_dtgEditor.CurrentRow; if (viewRow != null) { DialogResult result = MessageBox.Show(this, "确定删除整行吗?", "删除操作", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { DataRow row = m_dtbSource.Rows[viewRow.Index]; foreach (clsLisQCConcentrationVO con in m_objBatch.GetConcentrations()) { clsLisQCDataVO vo = row[con.m_intConcentrationSeq + "obj"] as clsLisQCDataVO; if (vo != null) { if (vo.m_intSeq != -1) { row[con.m_intConcentrationSeq + "obj"] = System.DBNull.Value; this.m_lstDeletedVOS.Add(vo); } else { this.m_lstAddedVOS.Remove(vo); } } } m_dtbSource.Rows.RemoveAt(viewRow.Index); } } }
private clsLisQCDataVO[] ConstructVOArr(DataTable dtbResult) { clsLisQCDataVO[] p_objResultArr = new clsLisQCDataVO[dtbResult.Rows.Count]; for (int i = 0; i < p_objResultArr.Length; i++) { p_objResultArr[i] = new clsLisQCDataVO(); ConstructVO(dtbResult.Rows[i], ref p_objResultArr[i]); } return(p_objResultArr); }
public void m_mthAddDataTable(clsLisQCDataVO[] p_objQCDataArr) { if (p_objQCDataArr != null && p_objQCDataArr.Length > 0) { List <clsLisQCDataVO> list = new List <clsLisQCDataVO>(); list.AddRange(p_objQCDataArr); List <clsQCDataPairItem> qCDataPairItemList = clsQCDataPairItem.GetQCDataPairItemList(list); foreach (clsQCDataPairItem current in qCDataPairItemList) { string strFilter = string.Empty; strFilter = "date >= '"; strFilter += current.QCDate.ToString("yyyy-MM-dd 00:00:00"); strFilter += "' and date <= '"; strFilter += current.QCDate.ToString("yyyy-MM-dd 23:59:59") + "'"; DataRow[] drr = this.m_dtbSource.Select(strFilter); if (drr != null && drr.Length > 0) { DataRow dataRow = drr[0]; int[] seqArr = this.m_objBatch.SeqArr; for (int i = 0; i < seqArr.Length; i++) { int p_intBatchSeq = seqArr[i]; clsLisQCDataVO qcDataVo = current[p_intBatchSeq]; if (qcDataVo != null) { if (dataRow[p_intBatchSeq.ToString()] == DBNull.Value) { dataRow[p_intBatchSeq.ToString()] = qcDataVo.m_dlbResult; } } } } else { DataRow dataRow = this.m_dtbSource.NewRow(); dataRow["date"] = current.QCDate.Date; dataRow["strdate"] = current.QCDate.Date.ToString("yyyy-MM-dd"); int[] seqArr = this.m_objBatch.SeqArr; for (int i = 0; i < seqArr.Length; i++) { int p_intBatchSeq = seqArr[i]; clsLisQCDataVO qcDataVo = current[p_intBatchSeq]; if (qcDataVo != null) { dataRow[p_intBatchSeq.ToString()] = qcDataVo.m_dlbResult; dataRow[p_intBatchSeq.ToString() + "obj"] = qcDataVo; } } this.m_dtbSource.Rows.Add(dataRow); } } } }
/// <summary> /// 判断是否存在与指定样本结果相同的浓度序号,如果存在返回true,否则返回false /// </summary> /// <param name="p_objDataVO"></param> /// <returns></returns> private bool IsExistSameBatch(clsLisQCDataVO p_objDataVO) { foreach (clsLisQCDataVO vo in m_arrData) { if (p_objDataVO.m_intQCBatchSeq == vo.m_intQCBatchSeq) { return(true); } } return(false); }
public bool Add(clsLisQCDataVO p_objDataVO) { bool isExist = IsExistSameConcentration(p_objDataVO); if (isExist) { return(false); } m_arrData.Add(p_objDataVO); return(true); }
public void ConstructVO(DataRow p_dtrSource, ref clsLisQCDataVO p_objQCData) { //DATA_SEQ_INT, QCBATCH_SEQ_INT, RESULT_NUM, // CONCENTRATION_SEQ_INT, QCDATE_DAT p_objQCData.m_intSeq = DBAssist.ToInt32(p_dtrSource["DATA_SEQ_INT"]); p_objQCData.m_intQCBatchSeq = DBAssist.ToInt32(p_dtrSource["QCBATCH_SEQ_INT"]); p_objQCData.m_dlbResult = DBAssist.ToDouble(p_dtrSource["RESULT_NUM"]); p_objQCData.m_intConcentrationSeq = DBAssist.ToInt32(p_dtrSource["CONCENTRATION_SEQ_INT"]); p_objQCData.m_datQCDate = DBAssist.ToDateTime(p_dtrSource["QCDATE_DAT"]); }
private bool IsExistSameConcentration(clsLisQCDataVO p_objDataVO) { foreach (clsLisQCDataVO vo in m_arrData) { if (p_objDataVO.m_intConcentrationSeq == vo.m_intConcentrationSeq) { return(true); } } return(false); }
private void AddYouDenLineItems() { PointPairList lstPairYouDen = new PointPairList(); if (m_lstQCDataPairItem != null && m_lstQCDataPairItem.Count > 0) { double X1 = m_lstChoiceConcentration[0].m_dblAVG; double X2 = m_lstChoiceConcentration[1].m_dblAVG; double SD1 = m_lstChoiceConcentration[0].m_dblSD; double SD2 = m_lstChoiceConcentration[1].m_dblSD; if (SD1 == 0) { SD1 = double.MaxValue; } if (SD2 == 0) { SD2 = double.MaxValue; } foreach (clsQCDataPairItem pair in m_lstQCDataPairItem) { clsLisQCDataVO conQCData = pair[m_lstChoiceConcentration[0].m_intQCBatchSeq]; if (conQCData != null) { lstPairYouDen.Add((conQCData.m_dlbResult - X1) / SD1, (conQCData.m_dlbResult - X2) / SD2); } else { continue; } } //foreach (clsQCDataPairItem pair in m_lstQCDataPairItem) //{ // clsLisQCDataVO conQCData1 = pair[m_lstChoiceConcentration[0].m_intConcentrationSeq]; // clsLisQCDataVO conQCData2 = pair[m_lstChoiceConcentration[1].m_intConcentrationSeq]; // if (conQCData1 != null && conQCData2 != null) // { // lstPairYouDen.Add((conQCData1.m_dlbResult - X1)/SD1 , (conQCData2.m_dlbResult - X2)/SD2); // } // else // { // continue; // } //} } if (lstPairYouDen != null && lstPairYouDen.Count > 0) { LineItem itemCurve = m_zedChart.GraphPane.AddCurve("", lstPairYouDen, Color.Red, SymbolType.Diamond); itemCurve.Line.IsVisible = false; itemCurve.Symbol.Fill = new Fill(Color.Red); } }
public long m_lngUpdate(clsLisQCDataVO p_objRecord) { long lngRes = 0; try { lngRes = m_objSvc.m_lngUpdate(m_objPrincipal, p_objRecord); } catch { lngRes = 0; } return(lngRes); }
private System.Data.IDataParameter[] GetUpdateDataParameterArr(clsLisQCDataVO p_objQCData) { System.Data.IDataParameter[] objODPArr = clsPublicSvc.m_objConstructIDataParameterArr ( p_objQCData.m_intQCBatchSeq, p_objQCData.m_dlbResult, p_objQCData.m_intConcentrationSeq, p_objQCData.m_datQCDate, p_objQCData.m_intSeq ); return(objODPArr); }
public List <clsLisQCDataVO> GetDatas() { List <clsLisQCDataVO> dataList = new List <clsLisQCDataVO>(); foreach (clsLisQCDataVO data in m_objDatas) { clsLisQCDataVO temp = new clsLisQCDataVO(); data.m_mthCopyTo(temp); dataList.Add(temp); } return(dataList); }
public long m_lngFind(int p_intID, out clsLisQCDataVO p_objRecord) { long lngRes = 0; p_objRecord = null; try { lngRes = m_objSvc.m_lngFind(m_objPrincipal, p_intID, out p_objRecord); } catch { lngRes = 0; } return(lngRes); }
public long m_lngUpdateByArr(System.Security.Principal.IPrincipal p_objPrincipal, clsLisQCDataVO[] p_objQCDataArr) { long lngRes = 0; if (p_objQCDataArr == null || p_objQCDataArr.Length <= 0) { return(lngRes); } clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, m_strCurrentSvcDetailName, "m_lngUpdateByArr"); if (lngRes <= 0) { return(-1); } try { int iCount = p_objQCDataArr.Length; DbType[] m_dbType = new DbType[] { DbType.Int32, DbType.Double, DbType.Int32, DbType.DateTime, DbType.Int32 }; object[][] objValues = new object[m_dbType.Length][]; for (int i = 0; i < objValues.Length; i++) { objValues[i] = new object[iCount]; } clsLisQCDataVO objTemp = null; for (int iRow = 0; iRow < iCount; iRow++) { objTemp = p_objQCDataArr[iRow]; objValues[0][iRow] = objTemp.m_intQCBatchSeq; objValues[1][iRow] = objTemp.m_dlbResult; objValues[2][iRow] = objTemp.m_intConcentrationSeq; objValues[3][iRow] = objTemp.m_datQCDate; objValues[4][iRow] = objTemp.m_intSeq; } clsHRPTableService objHRPServ = new clsHRPTableService(); lngRes = objHRPServ.m_lngSaveArrayWithParameters(m_strUpdateSql, objValues, m_dbType); } catch (Exception objEx) { new clsLogText().LogDetailError(objEx, true); } finally { p_objQCDataArr = null; } return(lngRes); }
/// <summary> /// 质控样本的结果比较,排序用,控质控日期 Asc, 按质结果序号 Asc /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> private static int CompareQCDataVO(clsLisQCDataVO x, clsLisQCDataVO y) { if (x == null) { if (y == null) { return(0); } else { return(-1); } } else { if (y == null) { return(1); } else { if (x.m_datQCDate > y.m_datQCDate) { return(1); } if (x.m_datQCDate == y.m_datQCDate) { if (x.m_intSeq > y.m_intSeq) { return(1); } else { if (x.m_intSeq == y.m_intSeq) { return(0); } else { return(-1); } } } else { return(-1); } } } }
private System.Data.IDataParameter[] GetInsertDataParameterArr(clsLisQCDataVO p_objQCData, int p_intSeq) { //DATA_SEQ_INT, QCBATCH_SEQ_INT, RESULT_NUM, //CONCENTRATION_SEQ_INT System.Data.IDataParameter[] objODPArr = clsPublicSvc.m_objConstructIDataParameterArr( p_intSeq, //序号 p_objQCData.m_intQCBatchSeq, p_objQCData.m_dlbResult, p_objQCData.m_intConcentrationSeq, p_objQCData.m_datQCDate ); return(objODPArr); }
public long m_lngInsert(clsLisQCDataVO p_objRecord) { int intID = -1; long lngRes = 0; try { lngRes = m_objSvc.m_lngInsert(m_objPrincipal, p_objRecord, out intID); } catch { lngRes = 0; } if (lngRes > 0) { p_objRecord.m_intSeq = intID; } return(lngRes); }
public long m_lngInsert(System.Security.Principal.IPrincipal p_objPrincipal, clsLisQCDataVO p_objQCData, out int p_intSeq) { long lngRes = 0; p_intSeq = -1; clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, m_strCurrentSvcDetailName, "m_lngInsert"); if (lngRes <= 0) { return(-1); } com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); try { lngRes = 0; lngRes = objHRPSvc.m_lngGenerateNewID(m_strTableName, m_strPrimaryKey, out p_intSeq); if (lngRes <= 0) { return(-1); } lngRes = 0; System.Data.IDataParameter[] objODPArr = GetInsertDataParameterArr(p_objQCData, p_intSeq); long lngRecEff = -1; //往表增加记录 lngRes = 0; lngRes = objHRPSvc.lngExecuteParameterSQL(m_strInsertSql, ref lngRecEff, objODPArr); objHRPSvc.Dispose(); if (lngRes > 0) { p_objQCData.m_intSeq = p_intSeq;//给VO赋值ID } else { p_intSeq = -1; } } catch (Exception objEx) { new clsLogText().LogError(objEx); } return(lngRes); }
/// <summary> /// 所有质控样本的结果数据 /// </summary> /// <returns></returns> public List <clsLisQCDataVO> GetDatas() { if (this.IsNull) { return(null); } List <clsLisQCDataVO> dataList = new List <clsLisQCDataVO>(); clsLisQCDataVO objTemp = null; foreach (clsLisQCDataVO data in m_objDatas) { objTemp = new clsLisQCDataVO(); data.m_mthCopyTo(objTemp); dataList.Add(objTemp); } return(dataList); }
// 根据浓度给DataPair相对值 private List <clsLisQCDataVO> m_lstDataListByConcentration() { List <clsQCDataPairItem> lstQCDataPair = m_lstQCDataPairItem; int intQCBatch = m_lstChoiceConcentration[0].m_intQCBatchSeq; List <clsLisQCDataVO> lst = new List <clsLisQCDataVO>(); clsLisQCDataVO objVOTemp = null; foreach (clsQCDataPairItem pair in lstQCDataPair) { objVOTemp = pair[intQCBatch]; if (objVOTemp != null) { lst.Add(objVOTemp); } } return(lst); }
private void m_cmdDeleteRow_Click(object sender, EventArgs e) { DataGridViewRow currentRow = this.m_dtgEditor.CurrentRow; DataRow row = ((DataRowView)currentRow.DataBoundItem).Row; if (row != null) { string s = row["strdate"].ToString().Trim(); DateTime minValue = DateTime.MinValue; if (DateTime.TryParse(s, out minValue)) { DialogResult dialogResult = MessageBox.Show(this, "确定删除整行吗?", "删除操作", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { int[] seqArr = this.m_objBatch.SeqArr; for (int i = 0; i < seqArr.Length; i++) { int num = seqArr[i]; clsLisQCDataVO clsLisQCDataVO = row[num.ToString() + "obj"] as clsLisQCDataVO; if (clsLisQCDataVO != null) { if (clsLisQCDataVO.m_intSeq != -1) { row[num.ToString() + "obj"] = DBNull.Value; this.m_lstDeletedVOS.Add(clsLisQCDataVO); } else { this.m_lstAddedVOS.Remove(clsLisQCDataVO); } } row[num.ToString()] = DBNull.Value; row[num.ToString() + "obj"] = DBNull.Value; } } } } }
/// <summary> /// 数据改变 /// </summary> /// <param name="p_objDatas"></param> public void UpdateDatas(List <clsLisQCDataVO> p_objDatas) { if (this.IsNull) { return; } if (p_objDatas != null) { this.m_objDatas.Clear(); this.m_strBrokenRules = string.Empty; foreach (clsLisQCDataVO var in p_objDatas) { clsLisQCDataVO temp = new clsLisQCDataVO(); var.m_mthCopyTo(temp); this.m_objDatas.Add(temp); } if (this.DataChanged != null) { DataChanged(this, null); } } }
public long m_lngGetDeviceQCDataBySampleID(System.Security.Principal.IPrincipal p_objPrincipal, string p_strSampleID, string p_strStartDat, string p_strEndDat, int[] p_intBatchSeqArr, out clsLisQCDataVO[] p_objQCDataArr) { p_objQCDataArr = null; long lngRes = 0; if (string.IsNullOrEmpty(p_strSampleID) || string.IsNullOrEmpty(p_strStartDat) || string.IsNullOrEmpty(p_strEndDat) || p_intBatchSeqArr == null || p_intBatchSeqArr.Length <= 0) { return(lngRes); } com.digitalwave.security.clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.LIS.clsTmdQCLisServ", "m_lngGetDeviceQCDataBySampleID"); objPrivilege = null; if (lngRes <= 0) { return(lngRes); } try { StringBuilder strSQLBuilder = new StringBuilder(512); strSQLBuilder.Append(@"select t.result_vchr, t.check_dat, d.qcbatch_seq_int from t_opr_lis_result t inner join t_bse_lis_device_check_item a on a.device_check_item_name_vchr = t.device_check_item_name_vchr and a.is_qc_item_int = 1 and a.has_graph_result_int = 0 inner join t_bse_lis_check_item_dev_item b on b.device_check_item_id_chr = a.device_check_item_id_chr and b.device_model_id_chr = a.device_model_id_chr inner join t_bse_lis_device c on c.device_model_id_chr = b.device_model_id_chr inner join t_opr_lis_qcbatch d on d.check_item_id_chr = b.check_item_id_chr where t.device_sampleid_chr = ? and t.deviceid_chr = c.deviceid_chr and t.check_dat between ? and ? and (d.qcbatch_seq_int = ?"); for (int index = 1; index < p_intBatchSeqArr.Length; index++) { strSQLBuilder.Append(" or d.qcbatch_seq_int = ?"); } strSQLBuilder.Append(")"); clsHRPTableService objHRPServ = new clsHRPTableService(); IDataParameter[] objDPArr = null; objHRPServ.CreateDatabaseParameter(p_intBatchSeqArr.Length + 3, out objDPArr); objDPArr[0].Value = p_strSampleID; objDPArr[1].DbType = DbType.DateTime; objDPArr[1].Value = Convert.ToDateTime(p_strStartDat); objDPArr[2].DbType = DbType.DateTime; objDPArr[2].Value = Convert.ToDateTime(p_strEndDat); for (int index = 0; index < p_intBatchSeqArr.Length; index++) { objDPArr[3 + index].Value = p_intBatchSeqArr[index]; } DataTable dtResult = null; lngRes = objHRPServ.lngGetDataTableWithParameters(strSQLBuilder.ToString(), ref dtResult, objDPArr); if (lngRes > 0 && dtResult != null && dtResult.Rows.Count > 0) { int iRowCount = dtResult.Rows.Count; List <clsLisQCDataVO> lstQCData = new List <clsLisQCDataVO>(); clsLisQCDataVO objTemp = null; DataRow drTemp = null; double dblTemp = 0d; for (int iRow = 0; iRow < iRowCount; iRow++) { drTemp = dtResult.Rows[iRow]; if (double.TryParse(drTemp["result_vchr"].ToString(), out dblTemp) && drTemp["check_dat"] != DBNull.Value) { objTemp = new clsLisQCDataVO(); objTemp.m_dlbResult = dblTemp; objTemp.m_datQCDate = Convert.ToDateTime(Convert.ToDateTime(drTemp["check_dat"]).ToString("yyyy-MM-dd")); objTemp.m_intSeq = -1; int.TryParse(drTemp["qcbatch_seq_int"].ToString(), out objTemp.m_intQCBatchSeq); objTemp.m_intConcentrationSeq = -1; lstQCData.Add(objTemp); } } if (lstQCData.Count > 0) { p_objQCDataArr = lstQCData.ToArray(); } } } catch (Exception objEx) { clsLogText objLogger = new clsLogText(); objLogger.LogDetailError(objEx, true); objLogger = null; } finally { p_intBatchSeqArr = null; p_strEndDat = null; p_strSampleID = null; p_strStartDat = null; } return(lngRes); }
/// <summary> /// 打印图片和数据 /// </summary> /// <param name="p_objPrintPageArgs"></param> private void m_mthPrintChart(System.Drawing.Printing.PrintPageEventArgs p_objPrintPageArgs) { Graphics g = p_objPrintPageArgs.Graphics; int chartHeight = 300; Rectangle rect = new Rectangle((int)(m_fltPrintWidth * 0.10f), (int)m_lngY + 10, (int)(m_fltPrintWidth * 0.8), chartHeight); m_zedGraph.DrawNoFontChart(g, rect); m_lngY += (long)chartHeight + 8; #region 本室浓度 //本室浓度 float fltStartX = m_fltPrintWidth * 0.125f; float fltCurrentX = fltStartX; SizeF sfWords = g.MeasureString("本室均值: ", m_fntMidleBold); g.DrawString("本室均值: ", m_fntMidleBold, Brushes.Black, fltCurrentX, m_lngY); // SD fltCurrentX = m_fltPrintWidth * 0.4f; g.DrawString("SD: ", m_fntMidleBold, Brushes.Black, fltCurrentX, m_lngY); // CV fltCurrentX = m_fltPrintWidth * 0.6f; g.DrawString("CV: ", m_fntMidleBold, Brushes.Black, fltCurrentX, m_lngY); if (m_lstQCDatas != null && m_lstQCDatas.Count > 0) { double[] dblDataArr = new double[m_lstQCDatas.Count]; for (int index = 0; index < m_lstQCDatas.Count; index++) { dblDataArr[index] = m_lstQCDatas[index].m_dlbResult; } double dblX = 0; double dblSD = 0; double dblCV = 0; long lngRes = clsLISPublic.m_lngCalculateSDXCV(dblDataArr, out dblX, out dblSD, out dblCV); if (lngRes > 0) { float fltInY = g.MeasureString("本室均值", m_fntMidleBold).Height - g.MeasureString("本室均值", m_fntSmallNotBold).Height; fltCurrentX = fltStartX; sfWords = g.MeasureString("本室均值: ", m_fntMidleBold); fltCurrentX += sfWords.Width; g.DrawString(dblX.ToString("0.00"), m_fntSmallNotBold, Brushes.Black, fltCurrentX, m_lngY + fltInY); // SD fltCurrentX = m_fltPrintWidth * 0.4f; sfWords = g.MeasureString("SD: ", m_fntMidleBold); fltCurrentX += sfWords.Width; g.DrawString(dblSD.ToString("0.00"), m_fntSmallNotBold, Brushes.Black, fltCurrentX, m_lngY + fltInY); // CV fltCurrentX = m_fltPrintWidth * 0.6f; sfWords = g.MeasureString("CV: ", m_fntMidleBold); fltCurrentX += sfWords.Width; g.DrawString(dblCV.ToString("0.0"), m_fntSmallNotBold, Brushes.Black, fltCurrentX, m_lngY + fltInY); } } m_lngY += Convert.ToInt64(sfWords.Height) + 3; #endregion #region 本室浓度数据 fltCurrentX = fltStartX; SizeF sizef = g.MeasureString("12.50", m_fntSmallNotBold); float width = sizef.Width; float height = sizef.Height + 2; int widSpace = 2; int heiSpace = 2; float xStep = width + widSpace; float yStep = height + heiSpace; float fltCurrentY = m_lngY; StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; clsLisQCDataVO objTemp = null; int iOneRowCount = 16; int iRowCount = m_lstQCDatas.Count / iOneRowCount; if (m_lstQCDatas.Count % iOneRowCount > 0) { iRowCount += 1; } int idxResult = 0; int fltCurPrintWidth = Convert.ToInt32(fltCurrentX + xStep * iOneRowCount); RectangleF recgF = new RectangleF(fltCurrentX, fltCurrentY, xStep, yStep); // 每行打印16个数据 if (iRowCount > 0) { g.DrawLine(m_GridPen, fltCurrentX, fltCurrentY, fltCurPrintWidth, fltCurrentY); for (int iRow = 0; iRow < iRowCount; iRow++) { fltCurrentX = fltStartX; g.DrawLine(m_GridPen, fltCurrentX, fltCurrentY + yStep, fltCurPrintWidth, fltCurrentY + yStep); g.DrawLine(m_GridPen, fltCurrentX, fltCurrentY + 2 * yStep, fltCurPrintWidth, fltCurrentY + 2 * yStep); g.DrawLine(m_GridPen, fltCurrentX, fltCurrentY, fltCurrentX, fltCurrentY + 2 * yStep); for (int index = 0; index < iOneRowCount; index++) { g.DrawLine(m_GridPen, fltCurrentX + xStep, fltCurrentY, fltCurrentX + xStep, fltCurrentY + 2 * yStep); if (idxResult < m_lstQCDatas.Count) { objTemp = m_lstQCDatas[idxResult]; recgF = new RectangleF(fltCurrentX, fltCurrentY, xStep, yStep); g.DrawString(objTemp.m_datQCDate.ToString("M.d"), m_fntSmallNotBold, Brushes.Black, recgF, sf); recgF.Y = fltCurrentY + yStep; g.DrawString(objTemp.m_dlbResult.ToString(), m_fntSmallNotBold, Brushes.Black, recgF, sf); idxResult += 1; } fltCurrentX += xStep; } fltCurrentY += 2 * yStep; } } #endregion m_lngY += Convert.ToInt64(yStep * 2 * iRowCount) + 10; }
/// <summary> /// 显示质控分析结果 /// </summary> /// <param name="p_blnChange"></param> private void m_mthShowAnalysisList(bool p_blnChange) { List <QualityControlRule> m_ruls = new List <QualityControlRule>(); QualityControlData m_qcData; List <clsLisQCDataVO> m_lstQCAnalysisVO = new List <clsLisQCDataVO>(); Hashtable m_hasAnalysisResult = new Hashtable(); QcParserXmlRules parser = new QcParserXmlRules(m_objBatch.GetQCBatchSet()[0].m_strQCRules); m_ruls = parser.RuleList; List <clsQCDataPairItem> lstQCDataPair = m_lstQCDataPairItem; foreach (clsQCDataPairItem pair in lstQCDataPair) { foreach (clsLisQCConcentrationVO con in m_lstChoiceConcentration) { if (pair[con.m_intQCBatchSeq] != null) { clsLisQCDataVO temp = pair[con.m_intQCBatchSeq]; if (p_blnChange) { temp = new clsLisQCDataVO(); pair[con.m_intQCBatchSeq].m_mthCopyTo(temp); double X = con.m_dblAVG; double SD = con.m_dblSD; if (SD == 0) { SD = double.MaxValue; } temp.m_dlbResult = (temp.m_dlbResult - X) / SD; } m_lstQCAnalysisVO.Add(temp); } } } double[] arrResult = new double[m_lstQCAnalysisVO.Count]; for (int i = 0; i < m_lstQCAnalysisVO.Count; i++) { arrResult[i] = m_lstQCAnalysisVO[i].m_dlbResult; } m_qcData = new QualityControlData(arrResult); if (p_blnChange) { m_qcData.X = 0f; m_qcData.SD = 1f; } else if (m_lstChoiceConcentration.Count > 0) { m_qcData.X = m_lstChoiceConcentration[0].m_dblAVG; m_qcData.SD = m_lstChoiceConcentration[0].m_dblSD; } m_hasAnalysisResult = QualityControlRulesParser.GetRulesDataResult(m_ruls, m_qcData); this.m_lsvQCResult.BeginUpdate(); this.m_lsvQCResult.Items.Clear(); if (m_hasAnalysisResult != null) { string ruleReport = string.Empty; foreach (DictionaryEntry dic in m_hasAnalysisResult) { List <clsLisQCDataVO> lstUnmatchedData = new List <clsLisQCDataVO>(); ruleReport += dic.Key.ToString() + "、"; ListViewItem item = new ListViewItem(dic.Key.ToString()); StringBuilder sb = new StringBuilder(); List <int> lstPos = (List <int>)dic.Value; foreach (int pos in lstPos) { // 填充不符合规则列表 lstUnmatchedData.Add(m_lstQCAnalysisVO[pos]); sb.Append("|"); sb.Append(m_lstQCAnalysisVO[pos].m_dlbResult); } item.Tag = lstUnmatchedData; item.SubItems.Add(sb.ToString()); this.m_lsvQCResult.Items.Add(item); } if (ruleReport != string.Empty) { m_objBatch.BrokenRules = ruleReport.Remove(ruleReport.Length - 1, 1); } } this.m_lsvQCResult.EndUpdate();//结束更新列表 }
private void m_dtbSource_ColumnChanged(object sender, DataColumnChangeEventArgs e) { string a = e.Row["strdate"].ToString().Trim(); if (a == this.m_strLocalX || a == this.m_strLocalSD || a == this.m_strLocalCV || a == this.m_strLocalConn) { e.Row.CancelEdit(); } else { string columnName = e.Column.ColumnName; this.m_dtbSource.ColumnChanged -= new DataColumnChangeEventHandler(this.m_dtbSource_ColumnChanged); if (!columnName.Contains("date") && !columnName.Contains("obj")) { string columnName2 = e.Column.ColumnName; clsLisQCDataVO clsLisQCDataVO = e.Row[columnName2 + "obj"] as clsLisQCDataVO; if (clsLisQCDataVO != null) { if (clsLisQCDataVO.m_intSeq == -1) { if (e.Row[e.Column].ToString() == string.Empty) { this.m_lstAddedVOS.Remove(clsLisQCDataVO); } else { try { double dlbResult = Convert.ToDouble(e.Row[e.Column]); clsLisQCDataVO.m_dlbResult = dlbResult; } catch { } } } else { if (e.Row[e.Column].ToString() != string.Empty) { try { double dlbResult = Convert.ToDouble(e.Row[e.Column]); clsLisQCDataVO.m_dlbResult = dlbResult; } catch { } this.m_lstChangedVOS.Add(clsLisQCDataVO); } else { try { clsLisQCDataVO item = e.Row[columnName2 + "obj"] as clsLisQCDataVO; this.m_lstDeletedVOS.Add(item); e.Row[columnName2 + "obj"] = DBNull.Value; } catch { } } } } if (clsLisQCDataVO == null && e.Row[e.Column].ToString() != string.Empty) { if (e.Row["date"].ToString() == string.Empty) { MessageBox.Show("请先输入日期!"); e.Row[e.Column] = DBNull.Value; } else { clsLisQCDataVO clsLisQCDataVO2 = new clsLisQCDataVO(); clsLisQCDataVO2.m_intSeq = -1; clsLisQCDataVO2.m_intQCBatchSeq = Convert.ToInt32(columnName2); clsLisQCDataVO2.m_intConcentrationSeq = -1; try { clsLisQCDataVO2.m_dlbResult = Convert.ToDouble(e.Row[e.Column]); } catch { } try { clsLisQCDataVO2.m_datQCDate = Convert.ToDateTime(e.Row["date"]); } catch { } e.Row[columnName2 + "obj"] = clsLisQCDataVO2; this.m_lstAddedVOS.Add(clsLisQCDataVO2); } } } if (e.Column.ColumnName == "date") { DateTime dateTime = DBAssist.ToDateTime(e.Row["date"]); if (dateTime != DBAssist.NullDateTime) { int[] seqArr = this.m_objBatch.SeqArr; for (int i = 0; i < seqArr.Length; i++) { int num = seqArr[i]; clsLisQCDataVO clsLisQCDataVO3 = e.Row[num.ToString() + "obj"] as clsLisQCDataVO; if (clsLisQCDataVO3 != null) { clsLisQCDataVO3.m_datQCDate = dateTime; e.Row[num.ToString() + "obj"] = clsLisQCDataVO3; this.m_lstChangedVOS.Add(clsLisQCDataVO3); } } } } if (!columnName.Contains("date") && !columnName.Contains("obj")) { this.m_mthComputeSDXCV(columnName); } this.m_dtbSource.ColumnChanged += new DataColumnChangeEventHandler(this.m_dtbSource_ColumnChanged); } }
//数据发生改变 private void m_dtbSource_ColumnChanged(object sender, DataColumnChangeEventArgs e) { if (e.Column.ColumnName != "date" && !e.Column.ColumnName.Contains("obj")) { string strConcentrationSeq = e.Column.ToString(); clsLisQCDataVO qcData = e.Row[strConcentrationSeq + "obj"] as clsLisQCDataVO; if (qcData != null) { //新增的,还未添加到数据库中的 if (qcData.m_intSeq == -1) { if (e.Row[e.Column].ToString() == string.Empty) { this.m_lstAddedVOS.Remove(qcData); } else { try { double dlbNewResult = Convert.ToDouble(e.Row[e.Column]); qcData.m_dlbResult = dlbNewResult; } catch { } } } // 数据库中有,更新 else { if (e.Row[e.Column].ToString() != string.Empty) { try { double dlbNewResult = Convert.ToDouble(e.Row[e.Column]); qcData.m_dlbResult = dlbNewResult; } catch { } this.m_lstChangedVOS.Add(qcData); } // 数据库中有的数据置为空后, // 数据从数据库中删除 else { try { clsLisQCDataVO delQCData = e.Row[strConcentrationSeq + "obj"] as clsLisQCDataVO; this.m_lstDeletedVOS.Add(delQCData); e.Row[strConcentrationSeq + "obj"] = System.DBNull.Value; } catch { } } } } //qcData=null if (qcData == null && e.Row[e.Column].ToString() != string.Empty) { //日期为空 if (e.Row["date"].ToString() == string.Empty) { MessageBox.Show("请先输入日期!"); e.Row[e.Column] = System.DBNull.Value; } else { //新增表中无,数据库中没有 clsLisQCDataVO newQCData = new clsLisQCDataVO(); newQCData.m_intSeq = -1; newQCData.m_intQCBatchSeq = this.m_objBatch.GetQCBatchSet().m_intSeq; try { newQCData.m_intConcentrationSeq = Convert.ToInt32(strConcentrationSeq); } catch { } try { newQCData.m_dlbResult = Convert.ToDouble(e.Row[e.Column]); } catch { } try { newQCData.m_datQCDate = Convert.ToDateTime(e.Row["date"]); } catch { } e.Row[strConcentrationSeq + "obj"] = newQCData; this.m_lstAddedVOS.Add(newQCData); } } } if (e.Column.ColumnName == "date") { DateTime dt = DBAssist.ToDateTime(e.Row["date"]); if (dt != DBAssist.NullDateTime) { foreach (clsLisQCConcentrationVO vo in m_objBatch.GetConcentrations()) { clsLisQCDataVO data = e.Row[vo.m_intConcentrationSeq + "obj"] as clsLisQCDataVO; if (data != null) { data.m_datQCDate = dt; e.Row[vo.m_intConcentrationSeq.ToString() + "obj"] = data; this.m_lstChangedVOS.Add(data); } } } } }