Beispiel #1
0
        //打印条码
        public void OnPrintSampleBarcode(string barcode, int pageCount, string nameCode)
        {
            bool addjkbool = false;

            if (grjdxx != null)
            {
                DataTable dt = grjddao.judgeRepeat(textBox3.Text);
                if (dt.Rows.Count < 1)
                {
                    grjdxx.archive_no = basicInfoSettings.xcuncode + grjdxx.Cardcode.Substring(14);
                    grjdxx.photo_code = grjdxx.Cardcode + ".jpg";
                    bool istrue = grjddao.addgrjdInfo(grjdxx);
                }
                jkBean jk = new jkBean();
                jk.aichive_no = grjdxx.archive_no;
                jk.id_number  = grjdxx.Cardcode;
                jk.bar_code   = barcode;
                jk.Pic1       = grjdxx.CardPic;
                jk.Pic2       = grjdxx.Cardcode + ".jpg";
                addjkbool     = grjddao.addJkInfo(jk);

                textBox5.Text = jk.aichive_no;
                textBox6.Text = barcode;
            }
            try
            {
                if (addjkbool)
                {
                    //调用Bartender
                    btApp = new BarTender.Application();
                    //获取打印模板,指定打印机
                    btFormat = btApp.Formats.Open(@str + "\\cs1.btw", false, "");
                    // 同样标签的份数
                    btFormat.PrintSetup.IdenticalCopiesOfLabel = pageCount;
                    // 序列标签数
                    btFormat.PrintSetup.NumberSerializedLabels = 1;
                    //设置参数 code
                    btFormat.SetNamedSubStringValue("code", barcode);
                    btFormat.SetNamedSubStringValue("nameCode", nameCode);
                    //打印开始 第2个参数是 是否显示打印机属性的。可以设置打印机路径
                    btFormat.PrintOut(false, false);
                    //关闭摸板文件,并且关闭文件流
                    btFormat.Close(BarTender.BtSaveOptions.btDoNotSaveChanges);
                    //打印完毕
                    btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("打印机设备连接不正确,请重新连接或重启!");
                //throw e;
            }
        }
Beispiel #2
0
        //打印条码
        public void OnPrintSampleBarcode(string barcode, int pageCount, string nameCode)
        {
            bool      addjkbool = false;
            DataTable dt        = null;

            if (grjdxx != null)
            {
                string cardcode = grjdxx.Cardcode;
                if (!"".Equals(cardcode))
                {
                    dt = grjddao.judgeRepeat(textBox3.Text);
                }
                else
                {
                    dt = grjddao.judgeRepeatBync(textBox1.Text, textBox8.Text);
                }
                if (dt.Rows.Count < 1)
                {
                    if (!"".Equals(cardcode))
                    {
                        grjdxx.archive_no = cardcode;
                    }
                    grjdxx.doctor_id = basicInfoSettings.zeren_doctorId;
                    grjddao.addgrjdInfo(grjdxx); //添加个人信息档案
                    registrationRecordCheck();   //右侧统计
                }
                else
                {
                    grjdxx.archive_no = dt.Rows[0]["archive_no"].ToString();
                    grjddao.updategejdInfonew(grjdxx, 0);
                    //grjdxx.archive_no = dt.Rows[0]["archive_no"].ToString();
                    //grjdxx.doctor_id= dt.Rows[0]["doctor_id"].ToString();
                    //grjddao.updateGrjdInfo(grjdxx.archive_no, grjdxx.photo_code);
                    //grjddao.updategejdInfo(grjdxx);
                }
                grjddao.addPhysicalExaminationInfo(grjdxx, barcode);//添加健康体检表信息
                jkBean jk = new jkBean();
                jk.aichive_no   = grjdxx.archive_no;
                jk.id_number    = grjdxx.Cardcode;
                jk.bar_code     = barcode;
                jk.Pic1         = grjdxx.CardPic;
                jk.Pic2         = grjdxx.Cardcode + ".jpg";
                jk.village_code = basicInfoSettings.xcuncode;
                jk.address      = grjdxx.Zhuzhi;
                jk.name         = grjdxx.name;
                jk.sex          = grjdxx.Sex;
                jk.age          = grjdxx.age;
                jk.JddwName     = basicInfoSettings.organ_name;
                jk.JdrName      = basicInfoSettings.input_name;
                jk.ZrysName     = basicInfoSettings.zeren_doctor;
                jk.XzjdName     = basicInfoSettings.xzName;
                jk.CjwhName     = basicInfoSettings.xcName;
                addjkbool       = grjddao.addJkInfo(jk);
                textBox5.Text   = jk.aichive_no;
                textBox6.Text   = barcode;
                if (addjkbool)
                {   //体检信息统计表
                    grjddao.addBgdcInfo(grjdxx, barcode, basicInfoSettings.xcuncode);
                }
            }
            try
            {
                if (addjkbool)
                {
                    //调用Bartender
                    btApp = new BarTender.Application();
                    //获取打印模板,指定打印机
                    btFormat = btApp.Formats.Open(@str + "\\cs1.btw", false, "");
                    // 同样标签的份数
                    btFormat.PrintSetup.IdenticalCopiesOfLabel = pageCount;
                    // 序列标签数
                    btFormat.PrintSetup.NumberSerializedLabels = 1;
                    //设置参数 code
                    btFormat.SetNamedSubStringValue("code", barcode);
                    btFormat.SetNamedSubStringValue("nameCode", nameCode);
                    //打印开始 第2个参数是 是否显示打印机属性的。可以设置打印机路径
                    btFormat.PrintOut(false, false);
                    //关闭摸板文件,并且关闭文件流
                    btFormat.Close(BarTender.BtSaveOptions.btDoNotSaveChanges);
                    //打印完毕
                    btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);
                    jkjcheckdao.updateShDevice(-1, -1, 1, -1, -1, -1, -1, -1, -1, -1);
                }
            }
            catch (Exception e)
            {
                loginLogBean lb = new loginLogBean();
                lb.name       = frmLogin.name;
                lb.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                lb.eventInfo  = "打印机设备连接不正确!";
                lb.type       = "3";
                logservice.addCheckLog(lb);
                MessageBox.Show(e.Message + "---" + e.StackTrace);
                MessageBox.Show("打印机设备连接不正确,请重新连接或重启!");
                jkjcheckdao.updateShDevice(-1, -1, 0, -1, -1, -1, -1, -1, -1, -1);
            }
            Common.SetComboBoxInfo(comboBox7, ltdorganizationDao.GetShengInfo());//默认区域
            DataTable dtbasic = bsdao.checkBasicsettingInfo();

            if (dtbasic.Rows.Count > 0)
            {
                xcuncode  = dtbasic.Rows[0]["cun_code"].ToString();
                shengcode = dtbasic.Rows[0]["sheng_code"].ToString();
                Common.SetComboBoxInfo(comboBox6, ltdorganizationDao.GetCityInfo(shengcode));
                shicode = dtbasic.Rows[0]["shi_code"].ToString();
                Common.SetComboBoxInfo(comboBox3, ltdorganizationDao.GetCountyInfo(shicode));
                qxcode = dtbasic.Rows[0]["qx_code"].ToString();
                Common.SetComboBoxInfo(comboBox4, areadao.zhenInfo(qxcode));
                xzcode = dtbasic.Rows[0]["xz_code"].ToString();
                Common.SetComboBoxInfo(comboBox5, areadao.cunInfo(xzcode));
                //因为名称有可能对应不上那么就用code对应
                Common.SetComboBoxSelectIndex(comboBox7, shengcode);
                Common.SetComboBoxSelectIndex(comboBox6, shicode);
                Common.SetComboBoxSelectIndex(comboBox3, qxcode);
                Common.SetComboBoxSelectIndex(comboBox4, xzcode);
                Common.SetComboBoxSelectIndex(comboBox5, xcuncode);
            }
        }