//自定义绑定数据
        private void requistionDate()
        {
            this.dataGridViewQG.AutoGenerateColumns = false;// 关闭自动创建列
            string sql = "select * from HY_RequisitionInfo order by r_ID desc";

            this.dataGridViewQG.DataSource = hyrepinfobll.ExecuteQuery(sql);
        }
 private void btnTO_Click(object sender, EventArgs e)
 {
     string did = this.q_DID.Text.Trim();
     if (did == string.Empty)
     {
         MessageBoxEx.Show("请输入请购单号后在执行抛单!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         this.q_DID.Focus();
         return;
     }
     HY_BLL.HY_RequisitionInfoBLL hyrepinfobll = new HY_RequisitionInfoBLL();
     did = did.Replace("QG", "CG");
     string fsq0 = "select r_DID,r_Supplier,r_State from HY_RequisitionInfo where r_DID='" + this.q_DID.Text.Trim() + "'";
     string fsql = "select c_DID from HY_ProcurementInfo where c_DID='" + did + "'";
     DataTable fh = hyrepinfobll.ExecuteQuery(fsq0);
     DataTable f = hyrepinfobll.ExecuteQuery(fsql);
     if (fh.Rows.Count > 0)
     {
         if (fh.Rows[0][1].ToString() == string.Empty)
         {
             MessageBoxEx.Show("此请购单供应商等信息没有添加,请添加后抛单!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             this.q_DID.Text = "";
             return;
         }
         if (fh.Rows[0][2].ToString() == "确认中")
         {
             MessageBoxEx.Show("此请购单等待确认中,确认后方可操作!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             this.q_DID.Text = "";
             return;
         }
     }
     if (f.Rows.Count > 0)
     {
         MessageBoxEx.Show("此请购单已抛转成采购单无需重复抛单!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         this.q_DID.Text = "";
     }
     else
     {
         string sql = "insert into HY_ProcurementInfo(c_DID,c_CID,c_Department,c_Person,c_Name,c_NameID,c_Supplier,c_Origin,c_QDate,c_XDate,c_Specifications,c_Units,c_Uses,c_Notes,c_Hot,c_Amount,c_ModClass) select REPLACE(r_DID,'QG','CG'),r_CID,r_Department,r_Person,r_Name,r_NameID,r_Supplier,r_Origin,r_QDate,r_XDate,r_Specifications,r_Units,r_Uses,r_Notes,r_Hot,r_Amount,r_ModClass from HY_RequisitionInfo WHERE r_DID='" + this.q_DID.Text.Trim() + "'";
         int res = hyrepinfobll.com_ExecuteQuery(sql);
         if (res > 0)
         {
             MessageBoxEx.Show("恭喜:请购单抛转采购单成功!", "提示", MessageBoxButtons.OK);
             this.Close();
         }
     }
 }
Exemple #3
0
        private void listView1_Click(object sender, EventArgs e)
        {
            HYSupplier   = this.listView1.SelectedItems[0].SubItems[2].Text; //窗口传值将变量赋值给方法
            GetMainvalue = this.listView1.SelectedItems[0].SubItems[0].Text; //窗口传值将变量赋值给方法
            ModelID      = this.listView1.SelectedItems[0].SubItems[1].Text; //窗口传值将变量赋值给方法
            string str_DID = this.listView1.SelectedItems[0].SubItems[0].Text;

            this.groupPanel2.Text = str_DID + "采购单产品列表";
            this.dataGridViewCGMX.AutoGenerateColumns = false;// 关闭自动创建列
            string sql = "select * from HY_ProcurementInfo where c_DID='" + str_DID + "'";

            this.dataGridViewCGMX.DataSource = hyrepinfobll.ExecuteQuery(sql);

            string sql1 = "select distinct c_Supplier from HY_ProcurementInfo where c_DID='" + str_DID + "'";

            this.Supplier.DataSource    = hyrepinfobll.ExecuteQuery(sql1);
            this.Supplier.DisplayMember = "c_Supplier";
        }
        private void listView1_Click(object sender, EventArgs e)
        {
            string str_DID = this.listView1.SelectedItems[0].SubItems[0].Text;

            this.dataGridViewQG.AutoGenerateColumns = false;// 关闭自动创建列
            string sql = "select * from HY_RequisitionInfo where r_DID='" + str_DID + "'";

            this.dataGridViewQG.DataSource = hyrepinfobll.ExecuteQuery(sql);
        }
        private void btnTO_Click(object sender, EventArgs e)
        {
            string did = this.b_BID.Text.Trim();
            if (did == string.Empty)
            {
                MessageBoxEx.Show("请输入物料单号!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.b_BID.Focus();
                return;
            }
            did = did.Replace("B", "QG");
            HY_BLL.HY_BomDetailsBLL hybom = new HY_BomDetailsBLL();
            string sql = "select b_HDate from HY_BomInfo where b_SKID='" + did + "'";
            SqlDataReader sdr = hybom.f_SQLBom(sql);
            while (sdr.Read())
            {
                if (sdr[0].ToString() == string.Empty)
                {
                    MessageBoxEx.Show("此物料单还未审核,请部门经理审核后再抛单", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            HY_BLL.HY_RequisitionInfoBLL hyrepinfobll = new HY_RequisitionInfoBLL();
            string fsql = "select * from HY_RequisitionInfo where r_DID='" + did + "'";
            DataTable f = hyrepinfobll.ExecuteQuery(fsql);
            if (f.Rows.Count > 0)
            {
                MessageBox.Show("此请购单已抛转成采购单无需重复抛单!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.b_BID.Text = "";
            }
            else
            {
                string sql2 = "insert into HY_RequisitionInfo(r_DID,r_CID,r_NameID,r_Name,r_Person,r_Origin,r_Specifications,r_Amount,r_Hot,r_Notes,r_QDate,r_ModClass) select REPLACE(d_SKID,'B','QG'),d_CID,d_PID,d_PName,d_SPerson,d_Model,d_Specifications,d_Amount,d_Heat,d_Notes,'" + DateTime.Now + "',d_ModClass from HY_BomDetails WHERE d_SKID='" + this.b_BID.Text.Trim() + "'";
                int res = hyrepinfobll.com_ExecuteQuery(sql2);
                if (res > 0)
                {
                    MessageBox.Show("恭喜:请购单抛转采购单成功!", "提示", MessageBoxButtons.OK);
                }
            }
        }
 private void listView1_Click(object sender, EventArgs e)
 {
     GetMainvalue = this.listView1.SelectedItems[0].SubItems[0].Text;//窗口传值将变量赋值给方法
     string str_DID = this.listView1.SelectedItems[0].SubItems[0].Text;
     this.groupPanel2.Text = str_DID + "采购单产品列表";
     this.dataGridViewCGMX.AutoGenerateColumns = false;// 关闭自动创建列
     HY_BLL.HY_RequisitionInfoBLL hyrepinfobll = new HY_RequisitionInfoBLL();
     string sql = "select * from HY_ProcurementInfo where c_DID='" + str_DID + "'";
     this.dataGridViewCGMX.DataSource = hyrepinfobll.ExecuteQuery(sql);
 }