private void txtBarCode_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string barCode = this.txtBarCode.Text.Trim(); if (barCode != string.Empty) { this.BarCode = barCode; if (this.PatchPrint) { if (!string.IsNullOrEmpty(barCode)) { clsDomainController_ApplicationManage domain = new clsDomainController_ApplicationManage(); string appId = domain.GetApplicationIdByBarcode(barCode); domain = null; if (!string.IsNullOrEmpty(appId)) { //生成条型码 string png = string.Empty; clsBarcodeMaker objBarcode = new clsBarcodeMaker(); objBarcode.CreateBarcodeBMP(barCode, out png); objBarcode = null; clsSealedBIHLisApplyReportPrint printTool = new clsSealedBIHLisApplyReportPrint(); printTool.m_mthGetPrintContent(appId, barCode); printTool.m_mthReport(0, ""); this.txtBarCode.Text = string.Empty; } } } else { this.DialogResult = DialogResult.OK; } } } }
/// <summary> /// 打印 /// </summary> public void m_mthPrint2() { string[] strSampleTypeIDArr = m_objViewer.m_strParmBlood.Split(new char[] { ';' }); List <clsLisApplMainVO> m_lstPrint = new List <clsLisApplMainVO>(); clsLisApplMainVO objTemp = null; if (strSampleTypeIDArr != null && strSampleTypeIDArr.Length > 0) { Dictionary <string, int> m_dicSampleTypeID = new Dictionary <string, int>(); for (int i = 0; i < strSampleTypeIDArr.Length; i++) { m_dicSampleTypeID.Add(strSampleTypeIDArr[i], i); } string strSampleTypeID = null; for (int i = 0; i < m_lstAppInfo.Count; i++) { objTemp = new clsLisApplMainVO(); m_lstAppInfo[i].m_mthCopyTo(objTemp); strSampleTypeID = m_lstAppInfo[i].m_strSampleTypeID; if (string.IsNullOrEmpty(strSampleTypeID)) { continue; } if (m_dicSampleTypeID.ContainsKey(strSampleTypeID)) { if (m_objViewer.m_blnIsBlood) { m_lstPrint.Add(objTemp); } } else { if (!m_objViewer.m_blnIsBlood) { m_lstPrint.Add(objTemp); } } } } clsSealedLisApplyReportPrint objPrint = new clsSealedLisApplyReportPrint(); string strLoginID = m_objViewer.m_strLoginID; long lngRes = 0; for (int i = 0; i < m_lstPrint.Count; i++) { objTemp = m_lstPrint[i]; if (objTemp.m_intReportPrint == 1) { continue; } //生成条型码 string png = string.Empty; clsBarcodeMaker objBarcode = new clsBarcodeMaker(); objBarcode.CreateBarcodeBMP(objTemp.m_strBarcode, out png); objBarcode = null; clsSealedBIHLisApplyReportPrint printTool = new clsSealedBIHLisApplyReportPrint(); printTool.m_mthGetPrintContent(objTemp.m_strAPPLICATION_ID, objTemp.m_strBarcode); printTool.m_mthReport(0, ""); lngRes = m_objDomain.m_lngInsertCollector(strLoginID, objTemp.m_strSampleID, objTemp.m_strAPPLICATION_ID); if (lngRes <= 0) { MessageBox.Show(m_objViewer, "条码打印失败,请重新打印", "打印条码提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (lngRes > 0) { m_mthDeleteRow(); } }
/// <summary> /// 打印 /// </summary> public void Print() { string[] SampleTypeIdArr = null; if (this.m_objViewer.BizType == 1) { SampleTypeIdArr = m_objViewer.m_strParmBlood.Trim().Split(new char[] { ';' }); } else if (this.m_objViewer.BizType == 2) { SampleTypeIdArr = m_objViewer.m_strParmBloodNo.Trim().Split(new char[] { ';' }); } List <clsLisApplMainVO> lstApp = new List <clsLisApplMainVO>(); clsLisApplMainVO vo = null; if (this.m_objViewer.BizType == 0) { foreach (clsLisApplMainVO item in m_lstAppInfo) { vo = new clsLisApplMainVO(); item.m_mthCopyTo(vo); lstApp.Add(vo); } } else { if (SampleTypeIdArr == null || SampleTypeIdArr.Length == 0) { return; } List <string> lstSampleId = new List <string>(); lstSampleId.AddRange(SampleTypeIdArr); foreach (clsLisApplMainVO item in m_lstAppInfo) { vo = new clsLisApplMainVO(); item.m_mthCopyTo(vo); if (string.IsNullOrEmpty(vo.m_strSampleTypeID)) { continue; } if (lstSampleId.IndexOf(vo.m_strSampleTypeID) >= 0) { lstApp.Add(vo); } } } clsSealedLisApplyReportPrint objPrint = new clsSealedLisApplyReportPrint(); string strLoginID = m_objViewer.m_strLoginID; long lngRes = 0; foreach (clsLisApplMainVO item in lstApp) { if (item.m_intReportPrint == 1) { continue; } //// 生成条型码 //string png = string.Empty; //clsBarcodeMaker objBarcode = new clsBarcodeMaker(); //objBarcode.CreateBarcodeBMP(item.m_strBarcode, out png); //objBarcode = null; clsSealedBIHLisApplyReportPrint printTool = new clsSealedBIHLisApplyReportPrint(); printTool.m_mthGetPrintContent(item.m_strAPPLICATION_ID, item.m_strBarcode); printTool.m_mthReport(0, ""); lngRes = m_objDomain.m_lngInsertCollector(strLoginID, item.m_strSampleID, item.m_strAPPLICATION_ID); if (lngRes <= 0) { MessageBox.Show(m_objViewer, "条码打印失败,请重新打印", "打印条码提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (lngRes > 0) { m_mthDeleteRow(); } }