Пример #1
0
        private void comboBoxEdit2_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            if (comboBoxEdit2.Text != "")
            {
                comboBoxEdit3.Properties.Items.Clear();
                string    sql        = "select * from tb_erpthird where 关联二级='" + comboBoxEdit2.Text + "'";
                DataTable dt         = SQLHELP.GetDataTable(sql, CommandType.Text);
                DataView  myDataView = new DataView(dt);
                string[]  strComuns  = { "关联二级", "三级" };
                dt = myDataView.ToTable(true, strComuns);


                List <string> spaceminute1 = new List <string>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string n = dt.Rows[i]["三级"].ToString();
                    spaceminute1.Add(n);
                }
                foreach (string s in spaceminute1)
                {
                    comboBoxEdit3.Properties.Items.Add(s);
                }
                comboBoxEdit2.Enabled = false;
                string sql11 = " select * from tb_xinerp    where  一级 ='" + comboBoxEdit1.Text.Trim() + "' and 二级= '" + comboBoxEdit2.Text.Trim() + "'";
                gridControl4.DataSource           = SQLHELP.GetDataTable(sql11, CommandType.Text);
                gridView4.Columns["id"].Visible   = false;
                gridView4.Columns["生成人"].Visible  = false;
                gridView4.Columns["生成时间"].Visible = false;
            }
        }
Пример #2
0
        private void 查看到货记录_Load(object sender, EventArgs e)
        {
            string    Sql1 = "select id,定位,部门,发货数量,发货时间 from tb_fahuojilu where 定位='" + 定位 + "'";
            DataTable dt2  = SQLHELP.GetDataTable(Sql1, CommandType.Text);

            gridControl1.DataSource = dt2;
        }
Пример #3
0
        private void FRwuliubuliaodan_Load(object sender, EventArgs e)
        {
            string sql1 = "select id, 序号,编码,型号,名称,单位,数量,类型,项目工令号,要求到货日期,备注,制造类型,申购人,收到料单日期,供方名称,合同号,实际采购数量,报价, 采购单价,实际到货日期,当前状态,采购料单备注,附件名称,附件类型,合同预计时间 from  tb_caigouliaodan  where 工作令号='" + gongzuolinghao + "' and 项目名称='" + xiangmumingcheng + "'and 时间='" + shijian + "' and   制造类型!='自制零部件' and   制造类型!='装配零部件'  and   制造类型!='库存件'";

            dt = SQLHELP.GetDataTable(sql1, CommandType.Text);
            dataGridViewX2.DataSource = dt;
        }
Пример #4
0
        private void comboBoxEdit3_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            comboBoxEdit3.Enabled = false;
            string sql11 = " select * from tb_xinerp    where  一级 ='" + comboBoxEdit1.Text.Trim() + "' and 二级= '" + comboBoxEdit2.Text.Trim() + "'  and 三级= '" + comboBoxEdit3.Text.Trim() + "'";

            gridControl4.DataSource           = SQLHELP.GetDataTable(sql11, CommandType.Text);
            gridView4.Columns["id"].Visible   = false;
            gridView4.Columns["生成人"].Visible  = false;
            gridView4.Columns["生成时间"].Visible = false;
        }
Пример #5
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if (txtwuzi.Text.Trim() == "")
            {
                MessageBox.Show("请输入需要查找的内容");
                return;
            }
            string sql = " select* from tb_xinerp    where  一级 like '%" + txtwuzi.Text.Trim() + "%' or 二级 like '%" + txtwuzi.Text.Trim() + "%'  or 三级 like '%" + txtwuzi.Text.Trim() + "%'  or 四级 like '%" + txtwuzi.Text.Trim() + "%' ";

            gridControl4.DataSource           = SQLHELP.GetDataTable(sql, CommandType.Text);
            gridView4.Columns["id"].Visible   = false;
            gridView4.Columns["生成人"].Visible  = false;
            gridView4.Columns["生成时间"].Visible = false;
        }
Пример #6
0
        public void ImportDialog()
        {
            //string sql = "select 工作令号,项目名称,设备名称,时间 from tb_jishubumen where id='" + zifuchuan[1] + "'";
            string    sql = "";
            DataTable dt  = SQLHELP.GetDataTable(sql, CommandType.Text);

            string gonglinghao      = dt.Rows[0]["工作令号"].ToString();
            string xiangmumingcheng = dt.Rows[0]["项目名称"].ToString();
            string shebeimingcheng  = dt.Rows[0]["设备名称"].ToString();
            string shijian          = dt.Rows[0]["时间"].ToString();

            FRwuliubuliaodan form = new FRwuliubuliaodan();

            form.gongzuolinghao   = gonglinghao;
            form.xiangmumingcheng = xiangmumingcheng;
            form.shijian          = shijian;
            form.ShowDialog();
        }
Пример #7
0
        private void Frerpcreat1_Load(object sender, EventArgs e)
        {
            string    sql = "select * from tb_erpfirst";
            DataTable dt  = SQLHELP.GetDataTable(sql, CommandType.Text);

            List <string> spaceminute1 = new List <string>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string n = dt.Rows[i]["一级"].ToString();
                spaceminute1.Add(n);
            }
            foreach (string s in spaceminute1)
            {
                comboBoxEdit1.Properties.Items.Add(s);
            }
            textBox1.Text   = 工作令号;
            textBox2.Text   = 项目名称;
            textBox_id.Text = id;
        }
Пример #8
0
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            if (comdanwei.Text.Trim() == "")
            {
                MessageBox.Show("必须选择单位!");
                return;
            }
            if (comboBoxEdit1.Text.Trim() == "")
            {
                MessageBox.Show("必须选择一级名称!");
                return;
            }
            if (comboBoxEdit2.Text.Trim() == "")
            {
                MessageBox.Show("必须选择二级名称!");
                return;
            }
            if (comboBoxEdit3.Text.Trim() == "")
            {
                MessageBox.Show("必须选择三级名称!");
                return;
            }
            if (txtyulan.Text == "")
            {
                MessageBox.Show("预览为空,请先预览再生成!");
                return;
            }

            string sql111 = "select * from tb_erpfirst where 一级='" + comboBoxEdit1.Text + "'";
            string yiji1  = Convert.ToString(SQLHELP.ExecuteScalar(sql111, CommandType.Text));

            if (yiji1 == "")
            {
                MessageBox.Show("一级名称不存在,请重新输入!");
                return;
            }
            string sql222 = "select * from tb_erpsecond where 二级='" + comboBoxEdit2.Text + "'";
            string erji2  = Convert.ToString(SQLHELP.ExecuteScalar(sql222, CommandType.Text));

            if (erji2 == "")
            {
                MessageBox.Show("二级名称不存在,请重新输入!");
                return;
            }
            string sql333 = "select * from tb_erpthird where 三级='" + comboBoxEdit3.Text + "'";
            string sanji3 = Convert.ToString(SQLHELP.ExecuteScalar(sql333, CommandType.Text));

            if (sanji3 == "")
            {
                MessageBox.Show("三级名称不存在,请重新输入!");
                return;
            }
            string    sql1122 = "select * from tb_xinerp where 三级='" + comboBoxEdit3.Text + "' and 四级='" + txtyulan.Text.Trim() + "'";
            DataTable dtttt   = SQLHELP.GetDataTable(sql1122, CommandType.Text);

            if (dtttt.Rows.Count > 0)
            {
                MessageBox.Show("该ERP已存在!");
                gridControl4.DataSource = SQLHELP.GetDataTable(sql1122, CommandType.Text);
                return;
            }

            if (MessageBox.Show("确认生号吗?", "软件提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                string sql12345 = "insert into tb_xinerp (一级,二级,三级,四级,单位,生成时间,生成人) VALUES ('" + comboBoxEdit1.Text.Trim() + "','" + comboBoxEdit2.Text.Trim() + "','" + comboBoxEdit3.Text.Trim() + "','" + txtyulan.Text.Trim() + "','" + comdanwei.Text.Trim() + "','" + DateTime.Now + "','" + yonghu + "')";
                SQLHELP.ExecuteScalar(sql12345, CommandType.Text);
                string    sql11 = "select * from tb_xinerp where 新编号 is  null ";
                DataTable dt    = SQLHELP.GetDataTable(sql11, CommandType.Text);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string id    = dt.Rows[i]["id"].ToString();
                    string yiji  = dt.Rows[i]["一级"].ToString();
                    string sql12 = " Select 编号 from tb_erpfirst where 一级='" + yiji.Trim() + "' ";
                    string id1   = SQLHELP.ExecuteScalar(sql12, CommandType.Text).ToString();
                    string yiji2 = dt.Rows[i]["二级"].ToString();
                    string sql2  = " Select id from tb_erpsecond where  二级='" + yiji2.Trim() + "' ";
                    string id2   = SQLHELP.ExecuteScalar(sql2, CommandType.Text).ToString();

                    if (id2.Length == 1)
                    {
                        id2 = "00" + id2;
                    }
                    if (id2.Length == 2)
                    {
                        id2 = "0" + id2;
                    }
                    string yiji3 = dt.Rows[i]["三级"].ToString();
                    string sql3  = " Select id from tb_erpthird where  三级='" + yiji3.Trim() + "' ";
                    string id3   = SQLHELP.ExecuteScalar(sql3, CommandType.Text).ToString();

                    if (id3.Length == 1)
                    {
                        id3 = "00000" + id3;
                    }
                    if (id3.Length == 2)
                    {
                        id3 = "0000" + id3;
                    }
                    if (id3.Length == 3)
                    {
                        id3 = "000" + id3;
                    }
                    if (id3.Length == 4)
                    {
                        id3 = "00" + id3;
                    }
                    if (id3.Length == 5)
                    {
                        id3 = "0" + id3;
                    }

                    string id4 = dt.Rows[i]["id"].ToString();

                    if (id4.Length == 1)
                    {
                        id4 = "00000" + id4;
                    }
                    if (id4.Length == 2)
                    {
                        id4 = "0000" + id4;
                    }
                    if (id4.Length == 3)
                    {
                        id4 = "000" + id4;
                    }
                    if (id4.Length == 4)
                    {
                        id4 = "00" + id4;
                    }
                    if (id4.Length == 5)
                    {
                        id4 = "0" + id4;
                    }
                    string yiji4 = id1 + id2 + id3 + id4;

                    string sql123456 = "update tb_xinerp set 新编号='" + yiji4 + "' where id='" + id + "'";
                    SQLHELP.ExecuteScalar(sql123456, CommandType.Text);
                    MessageBox.Show("生成成功!");

                    string sql112233 = " select * from tb_xinerp    where  新编号 ='" + yiji4 + "' ";
                    gridControl4.DataSource           = SQLHELP.GetDataTable(sql112233, CommandType.Text);
                    gridView4.Columns["id"].Visible   = false;
                    gridView4.Columns["生成人"].Visible  = false;
                    gridView4.Columns["生成时间"].Visible = false;
                }
            }
        }