Exemplo n.º 1
0
 /// <summary>
 /// 表2读取sql数据
 /// </summary>
 private void searchDgv2()
 {
     try
     {
         string sql2 = @" SELECT [pds_id] 产品编号
                           ,[glo_id] 类别代号
                           ,[pds_name]   产品名称
                           ,[pds_ename]  产品分类
                           ,[pds_spec]   规格型号
                           ,[cus_pds_id] 客户品号
                           ,[mak_id] 机组代号
                           ,[uni_id] 单位
                           ,[stk_id] 库位编号
                           ,[pur_mak]    购制代号
                       FROM [dbo].[PDS]
                 WHERE pds_id LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or pds_name LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or pds_ename LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or pds_spec LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or cus_pds_id LIKE '%" + toolSearchTxt.Text.Trim() + "%'";
         dataGridView1.DataSource = SQLHelper2.GetDataSet(sql2).Tables[0];
         label1.Visible           = false;
     }
     catch
     {
         MessageBox.Show("数据库连接失败!");
     }
 }
Exemplo n.º 2
0
        private void loading()
        {
            string strSql = @"SELECT * FROM [dbo].[GCB_JIHUA] WHERE flo_num='" + flo_num + "'";

            gunaDataGridView1.AutoGenerateColumns = false;
            //  label1.Visible = false;
            gunaDataGridView1.DataSource = SQLHelper2.GetDataSet(strSql).Tables[0];
            #region 根据订单数量分析,使用颜色标注状态
            for (int z = 0; z < gunaDataGridView1.RowCount; z++)
            {
                if (this.gunaDataGridView1.Rows[z].Cells["Column13"].Value.ToString() == "1")
                {
                    if (this.gunaDataGridView1.Rows[z].Cells["Column14"].Value.ToString() == "1")    //全部材料都满足
                    {
                        this.gunaDataGridView1.Rows[z].Cells["Column7"].Style.BackColor = Color.White;
                    }
                    if (this.gunaDataGridView1.Rows[z].Cells["Column14"].Value.ToString() == "0")    //满足本单 不满足计划
                    {
                        this.gunaDataGridView1.Rows[z].Cells["Column7"].Style.BackColor = Color.LightSalmon;
                    }
                }
                if (this.gunaDataGridView1.Rows[z].Cells["Column13"].Value.ToString() == "0")
                {
                    this.gunaDataGridView1.Rows[z].Cells["Column7"].Style.BackColor = Color.Red;
                }
            }
            #endregion
        }
Exemplo n.º 3
0
 /// <summary>
 /// 表1读取sql数据
 /// </summary>
 private void searchDgv1()
 {
     try
     {
         string sql1 = @"SELECT  [bom_id] 产品编号
                               ,[Expr1] 产品名称
                               ,[Expr2] 产品规格型号
                               ,[sortid] 序号
                               ,[pds_id] 材料编号
                               ,[pds_name] 材料名称
                               ,[pds_spec] 材料规格型号
                               ,[pur_mak] 购制
                               ,[qty] 标准用量
                               ,[base] 子件基量
                               ,[lost] 子件损耗
                   FROM [dbo].[GCB_BEWBOM]
                    WHERE bom_id LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or Expr1 LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or pds_name LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or pds_spec LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or Expr2 LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or pds_id LIKE '%" + toolSearchTxt.Text.Trim() + "%'";
         dataGridView1.DataSource = SQLHelper2.GetDataSet(sql1).Tables[0];
         label1.Visible           = false;
     }
     catch
     {
         MessageBox.Show("数据库连接失败!");
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 表3读取sql数据
 /// </summary>
 private void searchDgv3()
 {
     try
     {
         string sql3 = @"SELECT  [pds_id] 产品编号
                   ,[glo_id] 产品类别
                   ,[pds_name]   产品名称
                   ,[pds_spec]   规格型号
                   ,[cus_pds_id] 客户名称
                   ,[mak_name]   供应商名称
                   ,[stk_name]   库位名称
                   ,[stkqty] 库位数量
                   ,[uni_id] 单位
               FROM [dbo].[GCB_STK]
                 WHERE pds_id LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or glo_id LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or pds_name LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or pds_spec LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or mak_name LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or cus_pds_id LIKE '%" + toolSearchTxt.Text.Trim() + "%'";
         dataGridView1.DataSource = SQLHelper2.GetDataSet(sql3).Tables[0];
         label1.Visible           = false;
     }
     catch
     {
         MessageBox.Show("数据库连接失败!");
     }
 }
Exemplo n.º 5
0
        private void LoadTable()
        {
            string strSql = @"SELECT * from PDnotes WHERE  PDnum LIKE '%" + toolStripTextBox1.Text.Trim() +
                            "%' or PDcoding LIKE '%" + toolStripTextBox1.Text.Trim() + "%' order by PDtime";

            dt = SQLHelper2.GetDataSet(strSql).Tables[0];
            dataGridView1.DataSource = dt;
        }
Exemplo n.º 6
0
        private void frmOrderPlanAddHB_Load(object sender, EventArgs e)
        {
            string    sqlHB = @"SELECT
                                        [bom_id] 
                                        ,[pds_id]   
                                        ,[pds_name] 
                                        ,[pds_spec] 
                                        ,[dfsl] 
                                        ,[zfsl] 
                                        ,[dgslq]   
                                        ,[zgslq]    
                                        ,[stkqty]  
                                        ,[flo_num] 
                                        ,[numss] 
                                        ,[bdbig]
                                        ,[adbig]
                                    FROM [YouliData].[dbo].[GCB_FLOW_BOM_NUM1]
                                    WHERE bom_id = (SELECT TOP 1 [pds_id] FROM [YouliData].[dbo].[GCB_FLOW_BOM_NUM] WHERE flo_num = '" + floNum + "' AND pur_mak='1') AND flo_num='" + floNum + "'";
            DataTable dt    = SQLHelper2.GetDataSet(sqlHB).Tables[0];

            gunaDataGridView1.AutoGenerateColumns = false;
            gunaDataGridView1.DataSource          = dt;

            //表格颜色处理
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["bdbig"].ToString() == "1")
                {
                    if (dt.Rows[i]["adbig"].ToString() == "1")
                    {
                        this.gunaDataGridView1.Rows[i].Cells["Column6"].Style.BackColor = Color.White;
                    }
                    if (dt.Rows[i]["adbig"].ToString() == "0")
                    {
                        this.gunaDataGridView1.Rows[i].Cells["Column6"].Style.BackColor = Color.LightSalmon;
                    }
                }
                else
                {
                    this.gunaDataGridView1.Rows[i].Cells["Column6"].Style.BackColor = Color.Red;
                    this.gunaDataGridView1.Rows[i].Cells["Column6"].Style.ForeColor = Color.White;
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// 表4读取sql数据
 /// </summary>
 private void searchDgv4()
 {
     try
     {
         string sql3 = @"SELECT  [pds_id] 产品编号
                   ,[pds_name]   产品名称
                   ,[pds_spec]   规格型号
                   ,[hhstock] 库存数量
               FROM [dbo].[GCB_HH_STOCK]
                 WHERE pds_id LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or pds_name LIKE '%" + toolSearchTxt.Text.Trim() +
                       "%'or pds_spec LIKE '%" + toolSearchTxt.Text.Trim() + "%'";
         dataGridView1.DataSource = SQLHelper2.GetDataSet(sql3).Tables[0];
         label1.Visible           = false;
     }
     catch
     {
         MessageBox.Show("数据库连接失败!");
     }
 }
Exemplo n.º 8
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            DataTable dtQC;

            search();
            //string strQCnote = @"SELECT QCcoding FROM [YouliData].[dbo].[QCnotes]";
            //dtQC = SQLHelper2.GetDataSet(strQCnote).Tables[0];

            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    for (int j = 0; j < dtQC.Rows.Count; j++)
            //    {
            //        if(dt.Rows[i]["flo_coding"].ToString() == dtQC.Rows[j]["QCcoding"].ToString())
            //        {
            //            this.dataGridView1.Rows[i].Cells["Column4"].Style.BackColor = Color.Red;
            //            this.dataGridView1.Rows[i].Cells["Column4"].Style.ForeColor = Color.White;
            //        }
            //    }
            //}

            #region
            //根据QC问题进行标红
            string strQCnote = @"SELECT QCcoding FROM [YouliData].[dbo].[QCnotes] ";
            dtQC = SQLHelper2.GetDataSet(strQCnote).Tables[0];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                for (int j = 0; j < dtQC.Rows.Count; j++)
                {
                    if (dt.Rows[i]["flo_coding"].ToString() == dtQC.Rows[j]["QCcoding"].ToString())
                    {
                        this.dataGridView1.Rows[i].Cells["Column4"].Style.BackColor = Color.Red;
                        this.dataGridView1.Rows[i].Cells["Column4"].Style.ForeColor = Color.White;
                    }
                }
            }
            #endregion
        }
Exemplo n.º 9
0
        private void loading()
        {
            string strSql = @"SELECT   [flo_online]
                                      ,[flo_line]
                                      ,[flo_num]
                                      ,[flo_client]
                                      ,[flo_coding]
                                      ,[flo_model]
                                      ,[flo_proname]
                                      ,[flo_range]
                                      ,[flo_plastic]
                                      ,[flo_quantity]
                                      ,[flo_finish]
                                      ,[yishangxians]
                                      ,[flo_oliquan]
                                      ,[flo_back]
                                      ,[Names]
                                      ,[Expr1]
                                FROM GCB_LAST_JIHUA ";

            dt                       = SQLHelper2.GetDataSet(strSql).Tables[0];
            label1.Visible           = false;
            dataGridView1.DataSource = dt;
        }