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> /// <param name="Moudle">0 直接打印 1 预览</param> public void m_mthReport_bak(int Moudle, string p_strPrinterName) { DataStore dsApplyBill = new DataStore(); dsApplyBill.LibraryList = Application.StartupPath + @"\pb_lis.pbl"; dsApplyBill.DataWindowObject = "d_lis_applybill"; dsApplyBill.InsertRow(0); if (this.m_strBarCode != null && this.m_strBarCode.Trim() != "") { string BmpFile = ""; //Barcode.clsBarcodeBmp bcode = new Barcode.clsBarcodeBmp(); ////bcode.GetBarcode_Code39(this.m_strBarCode, out BmpFile); //bcode.GetBarcode_Code128(this.m_strBarCode, out BmpFile); //bcode = null; clsBarcodeMaker objBarcode = new clsBarcodeMaker(); objBarcode.CreateBarcodeBMP(this.m_strBarCode, out BmpFile); objBarcode = null; dsApplyBill.Modify("p_barcode.filename = '" + BmpFile + "'"); dsApplyBill.Modify("t_barcode.text = '" + this.m_strBarCode + "'"); } if (this.m_objReportInfo.m_strEmergency == "1") { dsApplyBill.Modify("t_emergency.text = '急'"); } else { dsApplyBill.Modify("t_emergency.text = ''"); } if (m_objReportInfo.m_strPatientType == "1" || m_objReportInfo.m_strPatientType == "3") { dsApplyBill.Modify("t_inpatidorcardid.text = '" + m_objReportInfo.m_strPatientInHospitalNO + "'"); } else { dsApplyBill.Modify("t_inpatidorcardid.text = '" + m_objReportInfo.m_strOutPatientNO + "'"); } dsApplyBill.Modify("t_patname.text = '" + m_objReportInfo.m_strPatientName + "'"); dsApplyBill.Modify("t_age.text = '" + m_objReportInfo.m_strAge + "'"); dsApplyBill.Modify("t_sex.text = '" + m_objReportInfo.m_strSex + "'"); dsApplyBill.Modify("t_deptname.text = '" + m_objReportInfo.m_strApplyDept + "'"); dsApplyBill.Modify("t_bedno.text = '" + m_objReportInfo.m_strBedNO + "'"); dsApplyBill.Modify("t_sample.text = '" + m_objReportInfo.m_strSampleType + "'"); if (!string.IsNullOrEmpty(m_objReportInfo.m_strColor)) { dsApplyBill.Modify("t_color.text = '" + m_objReportInfo.m_strColor + "'"); } string ItemName = m_mthAutoHeight(m_objReportInfo.m_strCheckContent.Trim()); dsApplyBill.Modify("t_itemname.text = '" + ItemName + "'"); dsApplyBill.Modify("t_applytime.text = '" + m_objReportInfo.m_strCollectDat + "'"); //修改打印机设置 if (!string.IsNullOrEmpty(p_strPrinterName)) { dsApplyBill.PrintProperties.PrinterName = p_strPrinterName; } else { if (!string.IsNullOrEmpty(strPrinterName)) { dsApplyBill.PrintProperties.PrinterName = strPrinterName; } else { dsApplyBill.PrintProperties.PrinterName = "lis_applybill"; } } if (Moudle == 0) { dsApplyBill.Print(true); } else if (Moudle == 1) { clsPublic.PrintDialog(dsApplyBill); } dsApplyBill = null; }
/// <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(); } }