Exemplo n.º 1
0
 private void PrintLabel(string docno)
 {
     try
     {
         lpt.Open();
         string sql = "select box_label_uni" +
                      " from pacsd_pm_box_gen " +
                      " where doc_no ='" + docno + "' " +
                      " and fct_code = '" + PaCSGlobal.LoginUserInfo.Fct_code + "' " +
                      " order by box_label_uni desc";
         DataTable dtResult = OracleHelper.ExecuteDataTable(sql);
         DataView  dvTree   = new DataView(dtResult);
         if (dtResult.Rows.Count > 0)
         {
             foreach (DataRowView dr in dvTree)
             {
                 lpt.Write(SetCmdText(dr[0].ToString()));
             }
         }
         lpt.Close();
     }
     catch (Exception PrintLabel)
     {
         XtraMessageBox.Show(this, "System error[PrintLabel]: " + PrintLabel.Message);
     }
 }
Exemplo n.º 2
0
        private void btnHotOpenDevice_Click(object sender, EventArgs e)
        {
            string port = this.txtHotPort.Text.Trim();

            if (port.StartsWith("lpt"))
            {
                if (helper.Open(this.txtHotPort.Text.Trim()))
                {
                    this.btnHotOpenDevice.Enabled    = false;
                    this.btnHotCloseDevice.Enabled   = true;
                    this.btnHotGetState.Enabled      = true;
                    this.btnBeginPrint.Enabled       = true;
                    this.btnEndPrint.Enabled         = false;
                    this.btnPrintCommandOnce.Enabled = true;
                    this.lbOperationHint.Text        = "打开并口成功!";
                    helper.Read(new HandleReturnStringDelegate(SetReadHint));
                }
                else
                {
                    this.lbOperationHint.Text = "打开并口失败!";
                }
            }
            else
            {
                try
                {
                    if (helper2.Open(port, Convert.ToInt32(this.txtBaudRate.Text.Trim()),
                                     (System.IO.Ports.Parity)Convert.ToInt32(this.txtParity.Text.Trim())
                                     , Convert.ToInt32(this.txtDataBits.Text.Trim()),
                                     (System.IO.Ports.StopBits)Convert.ToInt32(this.txtStopBit.Text.Trim())
                                     ))
                    {
                        this.btnHotOpenDevice.Enabled    = false;
                        this.btnHotCloseDevice.Enabled   = true;
                        this.btnHotGetState.Enabled      = true;
                        this.btnBeginPrint.Enabled       = true;
                        this.btnEndPrint.Enabled         = false;
                        this.btnPrintCommandOnce.Enabled = true;
                        this.lbOperationHint.Text        = "打开串口成功!";
                        helper2.Read(new HandleReturnStringDelegate(SetReadHint));
                    }
                    else
                    {
                        this.lbOperationHint.Text = "打开串口失败!";
                    }
                }
                catch (Exception ex)
                {
                    MessageBoxHelper.Show(ex.ToString());
                }
            }
        }