Ejemplo n.º 1
0
        //打印
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            string s = string.Empty;

            SqlConnect.ConnectStr connect = new SqlConnect.ConnectStr("ERP");
            string s1  = connect.GetConnectStr("ERP");
            int    ijk = 0;

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if (dataGridView1.Rows[i].Selected == true)
                {
                    s   = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    ijk = ijk + 1;
                }
            }
            if (ijk > 1)
            {
                MessageBox.Show("请逐一单据打印", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            List <Com.Hui.Controls.ReportParameter> list = new List <Com.Hui.Controls.ReportParameter>();

            list.Add(new Com.Hui.Controls.ReportParameter("bdbh", s));
            Com.Hui.Controls.ReportHelper.PrintReport("cllydjyt.frx", list, s1, true);
        }
Ejemplo n.º 2
0
        //查询
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;//等待
            dt.Clear();
            SqlConnect.ConnectStr connect = new SqlConnect.ConnectStr("ERP");
            string s = connect.GetConnectStr("ERP");
            string connectionString = s;

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "AfterPrintingDaily3";
                    SqlParameter[] para =
                    {
                        new SqlParameter("@DAH1",  SqlDbType.VarChar),
                        new SqlParameter("@DAH2",  SqlDbType.VarChar),
                        new SqlParameter("@DAH3",  SqlDbType.VarChar),
                        new SqlParameter("@DAH4",  SqlDbType.VarChar),
                        new SqlParameter("@DAH5",  SqlDbType.VarChar),
                        new SqlParameter("@TIME1", SqlDbType.DateTime),
                        new SqlParameter("@TIME2", SqlDbType.DateTime)
                    };
                    para[0].Value = toolStripComboBox1.Text; //班组
                    para[1].Value = toolStripComboBox2.Text; //机台名称
                    para[2].Value = toolStripTextBox1.Text;  //工单号
                    para[3].Value = toolStripTextBox2.Text;  //产品名称
                    para[4].Value = toolStripTextBox3.Text;  //部门名称
                    para[5].Value = sdate.Value.ToString("yyyy-MM-dd") + " 00:00:00";
                    para[6].Value = edate.Value.ToString("yyyy-MM-dd") + " 23:59:59";
                    try
                    {
                        cmd.CommandTimeout = 60 * 60 * 1000;
                        cmd.Parameters.AddRange(para);// 将参数加入命令对象
                        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                        adapter.Fill(dt);
                        conn.Close();
                        dataGridView1.DataSource = dt;
                        dataGridView1.RowsDefaultCellStyle.BackColor            = Color.Aquamarine;
                        dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Bisque;
                        dataGridView1.RowsDefaultCellStyle.Font = new Font("微软雅黑", 8, FontStyle.Regular);
                        dataGridView1.Refresh();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            this.Cursor = Cursors.Default;//正常状态
        }
Ejemplo n.º 3
0
        //查询
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;//等待
            dt.Clear();
            SqlConnect.ConnectStr connect = new SqlConnect.ConnectStr("ERP");
            string s = connect.GetConnectStr("ERP");
            string connectionString = s;

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = ProName;
                    SqlParameter[] para =
                    {
                        new SqlParameter("@WLMC",    SqlDbType.VarChar),
                        new SqlParameter("@WLLB",    SqlDbType.VarChar),
                        new SqlParameter("@ZBXH_CK", SqlDbType.VarChar),
                        new SqlParameter("@WLZL",    SqlDbType.VarChar),
                        new SqlParameter("@WLFL",    SqlDbType.VarChar),
                        new SqlParameter("@WLBH",    SqlDbType.VarChar)
                    };
                    para[0].Value = toolStripTextBox2.Text;
                    para[1].Value = ConvertWLDL("");
                    para[2].Value = ConvertCK(toolStripComboBox3.Text);
                    para[3].Value = ConvertWLZL("");
                    para[4].Value = ConvertWLFL(toolStripComboBox4.Text.ToString());
                    para[5].Value = toolStripTextBox1.Text;
                    try
                    {
                        cmd.CommandTimeout = 60 * 60 * 1000;
                        cmd.Parameters.AddRange(para);// 将参数加入命令对象
                        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                        adapter.Fill(dt);
                        conn.Close();
                        dataGridView1.DataSource = dt;
                        dataGridView1.RowsDefaultCellStyle.BackColor            = Color.Aquamarine;
                        dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Bisque;
                        dataGridView1.RowsDefaultCellStyle.Font = new Font("微软雅黑", 8, FontStyle.Regular);
                        dataGridView1.Refresh();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            this.Cursor = Cursors.Default;//正常状态
        }
Ejemplo n.º 4
0
        //查询
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;//等待
            dt.Clear();
            SqlConnect.ConnectStr connect = new SqlConnect.ConnectStr("ERP");
            string s = connect.GetConnectStr("ERP");
            string connectionString = s;

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "YUAN_CLCRK_Query";
                    SqlParameter[] para =
                    {
                        new SqlParameter("@STARTTIME", SqlDbType.DateTime),
                        new SqlParameter("@ENDTIME",   SqlDbType.DateTime)
                    };
                    para[0].Value = sdate.Value.ToString("yyyy-MM-dd") + " 00:00:00";
                    para[1].Value = edate.Value.ToString("yyyy-MM-dd") + " 23:59:59";
                    try
                    {
                        cmd.CommandTimeout = 60 * 60 * 10000;
                        cmd.Parameters.AddRange(para);// 将参数加入命令对象
                        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                        adapter.Fill(dt);
                        conn.Close();
                        dataGridView1.DataSource = dt;
                        dataGridView1.RowsDefaultCellStyle.BackColor            = Color.Azure;
                        dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.WhiteSmoke;
                        toolStripLabel2.Text = "总行数:" + (dt.Rows.Count).ToString();
                        dataGridView1.RowsDefaultCellStyle.Font = new Font("微软雅黑", 8, FontStyle.Regular);
                        dataGridView1.Refresh();
                        this.dataGridView1.Columns["XH"].Visible   = false;
                        this.dataGridView1.Columns["ZBXH"].Visible = false;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            this.Cursor = Cursors.Default;//正常状态
        }
Ejemplo n.º 5
0
        //查询
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;//等待
            dt.Clear();
            SqlConnect.ConnectStr connect = new SqlConnect.ConnectStr("ERP");
            string s = connect.GetConnectStr("ERP");
            string connectionString = s;

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "xinbanyinshuaribao";
                    SqlParameter[] para =
                    {
                        new SqlParameter("@zdrq", SqlDbType.DateTime),
                        new SqlParameter("@byb",  SqlDbType.SmallInt),
                        new SqlParameter("@zydy", SqlDbType.VarChar)
                    };
                    para[0].Value = sdate.Value.ToString("yyyy-MM-dd") + " 00:00:00";
                    para[1].Value = Convert.ToInt16(toolStripComboBox1.SelectedIndex);
                    para[2].Value = toolStripComboBox2.Text;
                    try
                    {
                        cmd.CommandTimeout = 60 * 60 * 1000;
                        cmd.Parameters.AddRange(para);// 将参数加入命令对象
                        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                        adapter.Fill(dt);
                        conn.Close();
                        dataGridView1.DataSource = dt;
                        dataGridView1.RowsDefaultCellStyle.BackColor            = Color.Aquamarine;
                        dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Bisque;
                        dataGridView1.RowsDefaultCellStyle.Font = new Font("微软雅黑", 8, FontStyle.Regular);
                        dataGridView1.Refresh();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            this.Cursor = Cursors.Default;//正常状态
        }
Ejemplo n.º 6
0
 //查询
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;//等待
     if (toolStripTextBox3.Text.Equals(""))
     {
         dt.Clear();
         SqlConnect.ConnectStr connect = new SqlConnect.ConnectStr("ERP");
         string s = connect.GetConnectStr("ERP");
         string connectionString = s;
         using (SqlConnection conn = new SqlConnection(connectionString))
         {
             conn.Open();
             using (SqlCommand cmd = conn.CreateCommand())
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.CommandText = ProName;
                 SqlParameter[] para =
                 {
                     new SqlParameter("@DAH1",      SqlDbType.VarChar),
                     new SqlParameter("@DAH2",      SqlDbType.VarChar),
                     new SqlParameter("@STARTTIME", SqlDbType.DateTime),
                     new SqlParameter("@ENDTIME",   SqlDbType.DateTime)
                 };
                 para[0].Value = toolStripTextBox1.Text;
                 para[1].Value = toolStripTextBox2.Text;
                 para[2].Value = sdate.Value.ToString("yyyy-MM-dd") + " 00:00:00";
                 para[3].Value = edate.Value.ToString("yyyy-MM-dd") + " 23:59:59";
                 try
                 {
                     cmd.CommandTimeout = 60 * 60 * 10000;
                     cmd.Parameters.AddRange(para);// 将参数加入命令对象
                     SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                     adapter.Fill(dt);
                     conn.Close();
                     dataGridView1.DataSource = dt;
                     dataGridView1.RowsDefaultCellStyle.BackColor            = Color.Aquamarine;
                     dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Bisque;
                     toolStripLabel6.Text = "总行数:" + (dt.Rows.Count).ToString();
                     dataGridView1.RowsDefaultCellStyle.Font = new Font("微软雅黑", 8, FontStyle.Regular);
                     dataGridView1.Refresh();
                     //获得datatable的列名
                     List <string> ls = SqlHelper.GetColumnsByDataTable(dt);
                     toolStripComboBox1.ComboBox.DataSource = ls;
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(ex.Message);
                 }
             }
         }
     }
     else
     {
         try {
             //获得现在所选列的列索引
             int       i            = toolStripComboBox1.ComboBox.SelectedIndex;
             string    dtcolounname = toolStripComboBox1.SelectedItem.ToString();
             DataRow[] dr           = dt.Select(dtcolounname + " like '%" + toolStripTextBox3.Text + "%'");
             DataTable dtt          = new DataTable();
             dtt = dt.Clone();
             if (dr.Length > 0)
             {
                 foreach (DataRow drVal in dr)
                 {
                     dtt.ImportRow(drVal);
                 }
             }
             dataGridView1.DataSource = dtt;
             toolStripLabel6.Text     = "总行数:" + (dtt.Rows.Count).ToString();
         }
         catch
         {
             MessageBox.Show("此列暂不支持筛选", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     this.Cursor = Cursors.Default;//正常状态
 }
Ejemplo n.º 7
0
 //查询
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     if (toolStripComboBox1.Text == "")
     {
         return;
     }
     if (toolStripComboBox2.Text == "")
     {
         return;
     }
     if (toolStripTextBox1.Text.Equals(""))
     {
         dt.Clear();
         this.Cursor = Cursors.WaitCursor;//等待
         SqlConnect.ConnectStr connect = new SqlConnect.ConnectStr("ERP");
         string s = connect.GetConnectStr("ERP");
         string connectionString = s;
         using (SqlConnection conn = new SqlConnection(connectionString))
         {
             conn.Open();
             using (SqlCommand cmd = conn.CreateCommand())
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.CommandText = ProName;
                 SqlParameter[] para =
                 {
                     new SqlParameter("@Years",  SqlDbType.Int),
                     new SqlParameter("@Months", SqlDbType.Int),
                     new SqlParameter("@Days",   SqlDbType.Int)
                 };
                 para[0].Value = Convert.ToInt16(toolStripComboBox2.Text);
                 para[1].Value = Convert.ToInt16(toolStripComboBox1.Text);
                 para[2].Value = Convert.ToInt16(PanDuan(toolStripComboBox2.Text, toolStripComboBox1.Text));
                 try
                 {
                     cmd.CommandTimeout = 60 * 60 * 1000;
                     cmd.Parameters.AddRange(para);// 将参数加入命令对象
                     SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                     adapter.Fill(dt);
                     conn.Close();
                     DataGridViewShow(dt);
                     //获得datatable的列名
                     List <string> ls = SqlHelper.GetColumnsByDataTable(dt);
                     toolStripComboBox3.ComboBox.DataSource = ls;
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(ex.Message);
                 }
             }
         }
     }
     else
     {
         try {
             //获得现在所选列的列索引
             int       i            = toolStripComboBox3.ComboBox.SelectedIndex;
             string    dtcolounname = toolStripComboBox3.SelectedItem.ToString();
             DataRow[] dr           = dt.Select(dtcolounname + " like '%" + toolStripTextBox1.Text + "%'");
             DataTable dtt          = new DataTable();
             dtt = dt.Clone();
             if (dr.Length > 0)
             {
                 foreach (DataRow drVal in dr)
                 {
                     dtt.ImportRow(drVal);
                 }
             }
             dataGridView1.DataSource = dtt;
             toolStripLabel3.Text     = "总行数:" + (dtt.Rows.Count).ToString();
         }
         catch
         {
             MessageBox.Show("此列暂不支持筛选", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     this.Cursor = Cursors.Default;//正常状态
 }
Ejemplo n.º 8
0
        //验证密码
        private void checkpassword()
        {
            //程序的超级用户权限,用于系统人员登录使用
            if (comboBox1.Text == "super")
            {
                if (textBox1.Text == "hyp")
                {
                    this.userID      = "00000";
                    this.userName    = "******";
                    this.auth        = "super";
                    MainFrm.userID   = this.userID;
                    MainFrm.userName = this.userName;
                    MainFrm.auth     = this.auth;
                    MainFrm.Dialog   = "OK";
                    this.Close();
                }
                else
                {
                    return;
                }
            }
            else if (comboBox1.Text == "" || textBox1.Text == "")
            {
                MessageBox.Show(strInformation1, strInformation2, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
            }
            else
            {
                //查找登录密码
                try
                {
                    DataTable             dt      = new DataTable();
                    string[]              a       = comboBox1.Text.Split('-');
                    string                sqls    = "select password from ZCX_YHQX_M where id='" + a[0] + "' ";
                    SqlConnect.ConnectStr connect = new SqlConnect.ConnectStr("ERP");
                    dt = connect.GetDataTable(sqls, "view");
                    SqlHelper.GetConnection().Close();

                    //查找用户装载界面权限
                    DataTable             dt1      = new DataTable();
                    string                sql1     = "select D.PermissionControl1,D.PermissionControl2 from ZCX_YHQX_M M left join ERPInquire_S_StaffTableM D on M.ERP_Authen = D.PermissionsID where M.id = '" + a[0] + "' ";
                    SqlConnect.ConnectStr connect1 = new SqlConnect.ConnectStr("ERP");
                    dt1 = connect.GetDataTable(sql1, "view");
                    SqlHelper.GetConnection().Close();

                    string per1 = Convert.ToString(dt1.Rows[0]["PermissionControl1"].ToString());
                    string per2 = Convert.ToString(dt1.Rows[0]["PermissionControl2"].ToString());

                    string pass = Convert.ToString(dt.Rows[0]["password"].ToString());

                    if (pass.Equals(textBox1.Text.Trim()) && a.Length == 2)
                    {
                        WriteTXT();
                        Writepwd();
                        this.userID   = a[0];
                        this.userName = a[1];
                        //查找用户菜单栏的权限并返回一个DataSet
                        MainFrm.ds1 = SelectToolStripName(per1);
                        //查找用户树形目录的权限并返回一个DataSet
                        MainFrm.ds2      = SelectTreeName(per2);
                        MainFrm.userID   = this.userID;
                        MainFrm.userName = this.userName;
                        MainFrm.auth     = this.auth;
                        MainFrm.Dialog   = "OK";
                        this.Close();
                    }
                    //
                    else
                    {
                        MessageBox.Show(strInformation1, strInformation2, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, strInformation2, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning);
                    //MessageBox.Show(ex.Message);
                }
            }
        }