Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            jg = (int)(Convert.ToDecimal(textBox1.Text.Trim()) * 1000);
            int iPort;

            for (iPort = 1001; iPort <= 1016; iPort++)
            {
                iRetUSB = CVRSDK.CVR_InitComm(iPort);
                if (iRetUSB == 1)
                {
                    break;
                }
            }
            if (iRetUSB != 1)
            {
                this.Invoke(new Action(() => { this.richTextBox1.AppendText(DateTime.Now.ToString("HH:mm:ss:fff") + "身份证读卡器初始化失败,请重试!\r\n"); }));
            }
            else
            {
                isread = true;
                this.Invoke(new Action(() =>
                {
                    this.richTextBox1.AppendText(DateTime.Now.ToString("HH:mm:ss:fff") + "初始化成功,循环读卡开始(0.2秒执行一次)...\r\n");
                }));
                new Thread(new ThreadStart(ReadIDCard))
                {
                    IsBackground = true
                }.Start();
            }
        }
Beispiel #2
0
        public void InitIdReader()
        {
            int iPort, iRetUSB = 0;

            for (iPort = 1001; iPort <= 1016; iPort++)
            {
                iRetUSB = CVRSDK.CVR_InitComm(iPort);
                if (iRetUSB == 1)
                {
                    break;
                }
            }

            if (iRetUSB != 1)
            {
                throw new Exception();
            }
        }
Beispiel #3
0
 /// <summary>
 /// 打开身份证读卡器端口
 /// </summary>
 /// <returns>true成功 false失败</returns>
 public bool openPort()
 {
     try
     {
         int iPort = 1002;
         iRetUSB = CVRSDK.CVR_InitComm(iPort);
         if (iRetUSB == 1)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #4
0
        private void FormMR_Load(object sender, EventArgs e)
        {
            //身份证读卡相关
            try
            {
                int iPort;
                for (iPort = 1001; iPort <= 1016; iPort++)
                {
                    //Console.WriteLine("iPort:" + iPort);
                    iRetUSB = CVRSDK.CVR_InitComm(iPort);
                    if (iRetUSB == 1)
                    {
                        break;
                    }
                }
                if (iRetUSB != 1)
                {
                    for (iPort = 1; iPort <= 4; iPort++)
                    {
                        iRetCOM = CVRSDK.CVR_InitComm(iPort);
                        if (iRetCOM == 1)
                        {
                            break;
                        }
                    }
                }

                if ((iRetCOM == 1) || (iRetUSB == 1))
                {
                    lblMsgQueryClient.Text = DateTime.Now.ToString("HH:mm:ss") + " 初始化成功!";
                }
                else
                {
                    lblMsgQueryClient.Text = DateTime.Now.ToString("HH:mm:ss") + " 初始化失败!";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #5
0
        private void personRegist_Load(object sender, EventArgs e)
        {
            this.label1.Text      = "居民健康档案登记";
            this.label1.ForeColor = Color.SkyBlue;
            label1.Font           = new Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, GraphicsUnit.Point, ((byte)(134)));
            label1.Left           = (this.panel1.Width - this.label1.Width) / 2;
            label1.BringToFront();

            this.label13.Text      = "登记记录";
            this.label13.ForeColor = Color.SkyBlue;
            label13.Font           = new Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, GraphicsUnit.Point, ((byte)(134)));
            label13.Left           = (this.panel4.Width - this.label13.Width) / 2;
            label13.BringToFront();

            label14.Text = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月" + DateTime.Now.Day.ToString() + "日";

            //身份证读卡初始化
            try
            {
                int iPort;
                for (iPort = 1001; iPort <= 1016; iPort++)
                {
                    iRetUSB = CVRSDK.CVR_InitComm(iPort);
                    if (iRetUSB == 1)
                    {
                        break;
                    }
                }
                if (iRetUSB != 1)
                {
                    for (iPort = 1; iPort <= 4; iPort++)
                    {
                        iRetCOM = CVRSDK.CVR_InitComm(iPort);
                        if (iRetCOM == 1)
                        {
                            break;
                        }
                    }
                }

                if ((iRetCOM == 1) || (iRetUSB == 1))
                {
                    this.label42.Text = "初始化成功!";
                }
                else
                {
                    this.label42.Text = "初始化失败!";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            //摄像头初始化
            try
            {
                // 枚举所有视频输入设备
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

                if (videoDevices.Count == 0)
                {
                    throw new ApplicationException();
                }
                //foreach (FilterInfo device in videoDevices)
                //{
                //    tscbxCameras.Items.Add(device.Name);
                //}
                //tscbxCameras.SelectedIndex = 0;

                VideoCaptureDevice videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
                videoSource.DesiredFrameSize   = new System.Drawing.Size(320, 240);
                videoSource.DesiredFrameRate   = 1;
                videoSourcePlayer1.VideoSource = videoSource;
                videoSourcePlayer1.Start();
            }
            catch (ApplicationException)
            {
                videoDevices = null;
            }
        }
Beispiel #6
0
        private void personRegist_Load(object sender, EventArgs e)
        {
            this.label1.Text      = "居民健康档案登记";
            this.label1.ForeColor = Color.SkyBlue;
            label1.Font           = new Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, GraphicsUnit.Point, ((byte)(134)));
            label1.Left           = (this.panel1.Width - this.label1.Width) / 2;
            label1.BringToFront();

            this.label13.Text      = "登记记录";
            this.label13.ForeColor = Color.SkyBlue;
            label13.Font           = new Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, GraphicsUnit.Point, ((byte)(134)));
            label13.Left           = (this.panel4.Width - this.label13.Width) / 2;
            label13.BringToFront();

            BindNation();
            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);
            }

            label14.Text = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月" + DateTime.Now.Day.ToString() + "日";
            registrationRecordCheck();//右侧统计信息
            //身份证读卡初始化
            try
            {
                int iPort;
                for (iPort = 1001; iPort <= 1016; iPort++)
                {
                    iRetUSB = CVRSDK.CVR_InitComm(iPort);
                    if (iRetUSB == 1)
                    {
                        break;
                    }
                }
                if (iRetUSB != 1)
                {
                    for (iPort = 1; iPort <= 4; iPort++)
                    {
                        iRetCOM = CVRSDK.CVR_InitComm(iPort);
                        if (iRetCOM == 1)
                        {
                            break;
                        }
                    }
                }

                if ((iRetCOM == 1) || (iRetUSB == 1))
                {
                    this.label42.Text = "初始化成功!";
                    jkjcheckdao.updateShDevice(1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
                }
                else
                {
                    this.label42.Text = "初始化失败!";
                    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);
                    jkjcheckdao.updateShDevice(0, -1, -1, -1, -1, -1, -1, -1, -1, -1);
                }
            }
            catch (Exception ex)
            {
                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);
                jkjcheckdao.updateShDevice(0, -1, -1, -1, -1, -1, -1, -1, -1, -1);
            }

            //摄像头初始化
            try
            {
                // 枚举所有视频输入设备
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

                if (videoDevices.Count == 0)
                {
                    throw new ApplicationException();
                }
                //foreach (FilterInfo device in videoDevices)
                //{
                //    tscbxCameras.Items.Add(device.Name);
                //}
                //tscbxCameras.SelectedIndex = 0;

                VideoCaptureDevice videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
                videoSource.DesiredFrameSize   = new System.Drawing.Size(320, 240);
                videoSource.DesiredFrameRate   = 1;
                videoSourcePlayer1.VideoSource = videoSource;
                videoSourcePlayer1.Start();
            }
            catch (ApplicationException)
            {
                videoDevices = null;
                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);
                jkjcheckdao.updateShDevice(-1, 0, -1, -1, -1, -1, -1, -1, -1, -1);
            }
            //读取默认的打印条数
            ReadPrintBarCodeNumber();
        }
Beispiel #7
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            share.Init();
            this.notifyIcon1.ShowBalloonTip(3000);
            int iPort;

            for (iPort = 1001; iPort <= 1016; iPort++)
            {
                iRetUSB = CVRSDK.CVR_InitComm(iPort);
                if (iRetUSB == 1)
                {
                    break;
                }
            }
            if (iRetUSB != 1)
            {
                this.Invoke(new Action(() =>
                {
                    ShowMsg("身份证读卡器初始化失败,请重试!", true);
                }));
            }
            else
            {
                this.Invoke(new Action(() =>
                {
                    ShowMsg("初始化读卡成功,开始读卡...", true);
                }));
                new Thread(new ThreadStart(ReadIDCard))
                {
                    IsBackground = true
                }.Start();
            }
            this.Hide();
            new Thread(() =>
            {
                int index = 0;
                while (true)
                {
                    if (index > 10)
                    {
                        BeginInvoke(new Action(() => { this.Hide(); }));
                        break;
                    }
                    Thread.Sleep(200);
                    index++;
                }
            })
            {
                IsBackground = true
            }.Start();

            new Thread(() =>
            {
                while (true)
                {
                    Thread.Sleep(60 * 2 * 1000);//每2分钟清空一次
                    BeginInvoke(new Action(() => { txtSoundMesInfo.Text = ""; }));
                }
            })
            {
                IsBackground = true
            }.Start();
        }
Beispiel #8
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            OracleDataAdapter bo01Adapter = SqlAssist.getSingleTableAdapter("select * from bo01");

            bo01Adapter.Fill(dt_bo01);

            List <Bo01> bo01_rows = ModelHelper.TableToEntity <Bo01>(dt_bo01);

            businessTab = bo01_rows.ToDictionary(key => key.bo001, value => value);

            Frm_login f_login = new Frm_login();

            f_login.ShowDialog();

            if (f_login.DialogResult == DialogResult.OK)              //登录成功处理..........
            {
                Bs_CURUSER.Caption = Envior.cur_userName;
                bs_version.Caption = AppInfo.AppVersion;
                f_login.Dispose();

                //读取发票基础信息
                this.ReadInvoiceBaseInfo();
            }

            //连接打印进程
            this.ConnectPrtServ();

            //自动连接博思服务器
            //string autoConnect = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["ConnectFinInvoice"].Value.ToString();
            //if (autoConnect == "1") FinInvoice.AutoConnectBosi();

            //创建打印服务对象
            //Envior.prtserv = new n_prtserv();

            //读取 税务开票 APPID
            Envior.TAX_APPID = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["APPID"].Value.ToString();
            //读取 财政发票 开票点编码
            Envior.FIN_BILL_SITE = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["BILLSITE"].Value.ToString();

            //打开身份证读取器
            Envior.IDC_Reader_State = false;
            if (ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["IDC_Reader"].Value.ToString() == "1")
            {
                Envior.IDC_Reader_Rate = int.Parse(ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["IDC_Reader_Rate"].Value.ToString());
                Envior.IDC_Reader_Port = int.Parse(ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["IDC_Reader_Port"].Value.ToString());
                CVRSDK.CVR_SetComBaudrate(Envior.IDC_Reader_Rate);  // 设置波特率
                if (0 == Envior.IDC_Reader_Port)                    //usb
                {
                    for (int i = 1001; i <= 1016; i++)
                    {
                        if (1 == CVRSDK.CVR_InitComm(i))
                        {
                            Envior.IDC_Reader_State = true;
                            Envior.IDC_Reader_Port  = i;
                            break;
                        }
                    }
                }
                else if (CVRSDK.CVR_InitComm(Envior.IDC_Reader_Port) == 1)                  //UART
                {
                    Envior.IDC_Reader_State = true;
                }

                if (!Envior.IDC_Reader_State)
                {
                    XtraMessageBox.Show("打开身份证读卡器失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                Envior.IDC_Reader_State = false;
            }

            if (Envior.IDC_Reader_State)
            {
                bsi_idc.Caption = "已连接";
            }
            else
            {
                bsi_idc.Caption = "未连接";
            }
        }