示例#1
0
        private void button确定_Click(object sender, EventArgs e)
        {
            Product pdt = new Product();

            // TODO validate name unique
            pdt.Name = textBox产品名称.Text;
            //if (pdt.Name == _oldName)
            //{
            //    MessageBox.Show("名字重复");
            //    return;
            //}
            pdt.Standard   = textBox规格.Text;
            pdt.Shift      = textBox变位.Text;
            pdt.RealShift  = textBox实测变位.Text;
            pdt.Texture    = textBox材质.Text;
            pdt.Color      = textBox颜色.Text;
            pdt.StockCount = int.Parse(label库存数.Text);
            double price;

            if (textBox单价.Text != "" && double.TryParse(textBox单价.Text, out price))
            {
                pdt.Price = price;
            }

            pdt.摆放要求     = textBox摆放要求.Text;
            pdt.备注       = textBox备注.Text;
            pdt.比重计      = textBox比重计.Text;
            pdt.边胶       = textBox边胶.Text;
            pdt.补强布大小    = textBox补强布大小.Text;
            pdt.布料编号     = textBox布料编号.Text;
            pdt.测试夹具外内   = textBox测试夹具外内.Text;
            pdt.成型机台     = textBox成型机台.Text;
            pdt.成型模号     = textBox成型模号.Text;
            pdt.成型上下模温度  = textBox成型上下模温度.Text;
            pdt.成型时间     = textBox成型时间.Text;
            pdt.成型首检变位   = textBox成型首检变位.Text;
            pdt.成型压力     = textBox成型压力.Text;
            pdt.打胶方式     = textBox打胶方式.Text;
            pdt.单个整条     = textBox单个整条.Text;
            pdt.单个整条切断   = textBox单个整条切断.Text;
            pdt.单面双面点胶   = textBox单面双面点胶.Text;
            pdt.刀模       = textBox刀模.Text;
            pdt.刀模中心定位   = textBox刀模中心定位.Text;
            pdt.导线方式     = textBox导线方式.Text;
            pdt.导线规格     = textBox导线规格.Text;
            pdt.导线长度     = textBox导线长度.Text;
            pdt.点锡长mm    = textBox点锡长.Text;
            pdt.定型时间     = textBox定型时间.Text;
            pdt.多个多条切断   = textBox多个多条.Text;
            pdt.方向数量     = textBox方向数量.Text;
            pdt.工艺要求     = textBox工艺要求.Text;
            pdt.含浸比重     = textBox含浸比重.Text;
            pdt.含浸转速HZ   = textBox含浸转速.Text;
            pdt.剪边喷水     = textBox剪边喷水.Text;
            pdt.胶滚压力     = textBox胶滚压力.Text;
            pdt.胶水       = textBox胶水.Text;
            pdt.胶水型号     = textBox胶水型号.Text;
            pdt.胶水重量     = textBox胶水重量.Text;
            pdt.搅拌时间     = textBox搅拌时间.Text;
            pdt.开料尺寸     = textBox开料尺寸.Text;
            pdt.开料要求     = textbox开料要求.Text;
            pdt.内留mm     = textBox内留.Text;
            pdt.气冲压力     = textBox气冲压力.Text;
            pdt.切刀模个数    = textBox切刀模个数.Text;
            pdt.切断机台     = textBox切断机台.Text;
            pdt.切断模      = textBox切断模.Text;
            pdt.切断模架     = textBox切断模架.Text;
            pdt.溶剂       = textBox溶剂.Text;
            pdt.生产单重     = textBox生产单重.Text;
            pdt.是否留样     = textBox是否留样.Text;
            pdt.是否备品     = textBox是否备品.Text;
            pdt.是否标签盖环保章 = textBox是否标签盖环保章.Text;
            pdt.是否产品全检   = textBox是否产品全检.Text;
            pdt.是否拉布成型   = textBox是否拉布成型.Text;
            pdt.是否数量超交   = textBox是否数量超交.Text;
            pdt.是否压纸板    = textBox是否压纸板.Text;
            pdt.是否中孔加补强布 = textBox是否中孔加补强布.Text;
            pdt.手动自动     = textBox手动自动.Text;
            pdt.贴合方式     = textBox贴合方式.Text;
            pdt.贴合机台     = textBox贴合机台.Text;
            pdt.贴合模具     = textBox贴合模具.Text;
            pdt.贴合压力     = textBox贴合压力.Text;
            pdt.通用气冲模    = textBox通用气冲模.Text;
            pdt.脱模剂      = textBox脱模剂.Text;
            pdt.外留mm     = textBox外留.Text;
            pdt.线距mm     = textBox线距.Text;
            pdt.压定位板     = textBox压定位板.Text;
            pdt.压纸板时间    = textBox压纸板时间.Text;
            pdt.样品变位     = textBox样品变位.Text;
            pdt.样品单重     = textBox样品单重.Text;
            pdt.硬化剂      = textBox硬化剂.Text;
            pdt.中孔模      = textBox中孔模.Text;
            pdt.自动切      = textBox自动切.Text;
            pdt.烤箱温度C    = textBox烤箱温度.Text;
            pdt.外贴标签要求   = textBox外贴标签要求.Text;
            pdt.批准       = textBox批准.Text;
            pdt.审核       = textBox审核.Text;
            pdt.制作       = textBox制作.Text;
            try
            {
                if (isUpdate)
                {
                    pdt.Id = beUpdateId;
                    prdMgr.AltProduct(pdt);
                }
                else
                {
                    int id = prdMgr.AddNewProduct(pdt);
                }

                MessageBox.Show("操作成功!");
                parent.updateDataView();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("修改失败!");
            }
        }
示例#2
0
 //********************************************************************************************
 public void 产品导入(string oleconn)
 {
     try
     {
         OleDbConnection conn = new OleDbConnection(oleconn);
         conn.Open();
         string           str_sql = "select * from [产品信息$]";
         OleDbDataAdapter oda     = new OleDbDataAdapter(str_sql, conn);
         DataSet          ds      = new DataSet();
         oda.Fill(ds);
         conn.Close();
         //ds为数据
         Product pdt = new Product();
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             // Convert.ToDouble(
             //     Convert.ToInt16(
             try
             {
                 pdt.Name       = ds.Tables[0].Rows[i][0].ToString();
                 pdt.Standard   = ds.Tables[0].Rows[i][1].ToString();
                 pdt.Texture    = ds.Tables[0].Rows[i][2].ToString();
                 pdt.Shift      = ds.Tables[0].Rows[i][3].ToString();
                 pdt.RealShift  = ds.Tables[0].Rows[i][4].ToString();
                 pdt.Color      = ds.Tables[0].Rows[i][5].ToString();
                 pdt.Unit       = ds.Tables[0].Rows[i][6].ToString();
                 pdt.Price      = Convert.ToDouble(ds.Tables[0].Rows[i][7].ToString());
                 pdt.StockCount = Convert.ToInt16(ds.Tables[0].Rows[i][8].ToString());
                 pdt.布料编号       = ds.Tables[0].Rows[i][9].ToString();
                 pdt.开料要求       = ds.Tables[0].Rows[i][10].ToString();
                 pdt.开料尺寸       = ds.Tables[0].Rows[i][11].ToString();
                 pdt.胶水型号       = ds.Tables[0].Rows[i][12].ToString();
                 pdt.溶剂         = ds.Tables[0].Rows[i][13].ToString();
                 pdt.脱模剂        = ds.Tables[0].Rows[i][14].ToString();
                 pdt.硬化剂        = ds.Tables[0].Rows[i][15].ToString();
                 pdt.含浸比重       = ds.Tables[0].Rows[i][16].ToString();
                 pdt.搅拌时间       = ds.Tables[0].Rows[i][17].ToString();
                 pdt.比重计        = ds.Tables[0].Rows[i][18].ToString();
                 pdt.胶滚压力       = ds.Tables[0].Rows[i][19].ToString();
                 pdt.含浸转速HZ     = ds.Tables[0].Rows[i][20].ToString();
                 pdt.烤箱温度C      = ds.Tables[0].Rows[i][21].ToString();
                 pdt.成型模号       = ds.Tables[0].Rows[i][22].ToString();
                 pdt.成型机台       = ds.Tables[0].Rows[i][23].ToString();
                 pdt.手动自动       = ds.Tables[0].Rows[i][24].ToString();
                 pdt.单个整条       = ds.Tables[0].Rows[i][25].ToString();
                 pdt.成型上下模温度    = ds.Tables[0].Rows[i][26].ToString();
                 pdt.成型时间       = ds.Tables[0].Rows[i][27].ToString();
                 pdt.成型压力       = ds.Tables[0].Rows[i][28].ToString();
                 pdt.自动切        = ds.Tables[0].Rows[i][39].ToString();
                 pdt.是否拉布成型     = ds.Tables[0].Rows[i][30].ToString();
                 pdt.是否中孔加补强布   = ds.Tables[0].Rows[i][31].ToString();
                 pdt.补强布大小      = ds.Tables[0].Rows[i][32].ToString();
                 pdt.是否压纸板      = ds.Tables[0].Rows[i][33].ToString();
                 pdt.剪边喷水       = ds.Tables[0].Rows[i][34].ToString();
                 pdt.压定位板       = ds.Tables[0].Rows[i][35].ToString();
                 pdt.定型时间       = ds.Tables[0].Rows[i][36].ToString();
                 pdt.压纸板时间      = ds.Tables[0].Rows[i][37].ToString();
                 pdt.刀模         = ds.Tables[0].Rows[i][38].ToString();
                 pdt.中孔模        = ds.Tables[0].Rows[i][39].ToString();
                 pdt.刀模中心定位     = ds.Tables[0].Rows[i][40].ToString();
                 pdt.切刀模个数      = ds.Tables[0].Rows[i][41].ToString();
                 pdt.切断模        = ds.Tables[0].Rows[i][42].ToString();
                 pdt.切断模架       = ds.Tables[0].Rows[i][43].ToString();
                 pdt.切断机台       = ds.Tables[0].Rows[i][44].ToString();
                 pdt.单个整条切断     = ds.Tables[0].Rows[i][45].ToString();
                 pdt.通用气冲模      = ds.Tables[0].Rows[i][46].ToString();
                 pdt.气冲压力       = ds.Tables[0].Rows[i][47].ToString();
                 pdt.多个多条切断     = ds.Tables[0].Rows[i][48].ToString();
                 pdt.导线方式       = ds.Tables[0].Rows[i][49].ToString();
                 pdt.导线规格       = ds.Tables[0].Rows[i][50].ToString();
                 pdt.内留mm       = ds.Tables[0].Rows[i][51].ToString();
                 pdt.外留mm       = ds.Tables[0].Rows[i][52].ToString();
                 pdt.点锡长mm      = ds.Tables[0].Rows[i][53].ToString();
                 pdt.导线长度       = ds.Tables[0].Rows[i][54].ToString();
                 pdt.方向数量       = ds.Tables[0].Rows[i][55].ToString();
                 pdt.线距mm       = ds.Tables[0].Rows[i][56].ToString();
                 pdt.单面双面点胶     = ds.Tables[0].Rows[i][57].ToString();
                 pdt.胶水         = ds.Tables[0].Rows[i][58].ToString();
                 pdt.边胶         = ds.Tables[0].Rows[i][59].ToString();
                 pdt.胶水重量       = ds.Tables[0].Rows[i][60].ToString();
                 pdt.摆放要求       = ds.Tables[0].Rows[i][61].ToString();
                 pdt.工艺要求       = ds.Tables[0].Rows[i][62].ToString();
                 pdt.打胶方式       = ds.Tables[0].Rows[i][63].ToString();
                 pdt.贴合方式       = ds.Tables[0].Rows[i][64].ToString();
                 pdt.贴合压力       = ds.Tables[0].Rows[i][65].ToString();
                 pdt.贴合模具       = ds.Tables[0].Rows[i][66].ToString();
                 pdt.贴合机台       = ds.Tables[0].Rows[i][67].ToString();
                 pdt.成型首检变位     = ds.Tables[0].Rows[i][68].ToString();
                 pdt.生产单重       = ds.Tables[0].Rows[i][69].ToString();
                 pdt.样品变位       = ds.Tables[0].Rows[i][70].ToString();
                 pdt.样品单重       = ds.Tables[0].Rows[i][71].ToString();
                 pdt.测试夹具外内     = ds.Tables[0].Rows[i][72].ToString();
                 pdt.是否留样       = ds.Tables[0].Rows[i][73].ToString();
                 pdt.是否备品       = ds.Tables[0].Rows[i][74].ToString();
                 pdt.是否产品全检     = ds.Tables[0].Rows[i][75].ToString();
                 pdt.是否数量超交     = ds.Tables[0].Rows[i][76].ToString();
                 pdt.是否标签盖环保章   = ds.Tables[0].Rows[i][77].ToString();
                 pdt.外贴标签要求     = ds.Tables[0].Rows[i][78].ToString();
                 pdt.备注         = ds.Tables[0].Rows[i][79].ToString();
                 pdt.批准         = ds.Tables[0].Rows[i][80].ToString();
                 pdt.审核         = ds.Tables[0].Rows[i][81].ToString();
                 pdt.制作         = ds.Tables[0].Rows[i][82].ToString();
                 if (pdtMgr.AddNewProduct(pdt) != 0)
                 {
                     richTextBox1.Text += "新产品[" + pdt.Name + "]生成成功!\r\n";
                 }
                 else
                 {
                     richTextBox1.Text += "新产品[" + pdt.Name + "]生成失败,请仔细核准数据!\r\n";
                 }
             }
             catch (Exception ex) { richTextBox1.Text += "新产品[" + pdt.Name + "]生成失败,请仔细核准数据!\r\n"; };
         }
     }
     catch (Exception ex) { richTextBox1.Text += "新产品生成失败,请仔细核准数据!\r\n"; };
 }