diff --git a/ConvertMoels/IonSQLConvert.cs b/ConvertMoels/IonSQLConvert.cs index 8e15f10..7bd30b4 100644 --- a/ConvertMoels/IonSQLConvert.cs +++ b/ConvertMoels/IonSQLConvert.cs @@ -33,29 +33,51 @@ namespace formula_manage.ConvertMoels { if (stuff_ion == "3") { - return "硫化"; + return "中性"; } else { if (stuff_ion == "4") { - return "阳离子"; + return "硫化"; } else { if (stuff_ion == "5") { - return "酞菁"; + return "阳离子"; } else { if (stuff_ion == "6") { - return "直接"; + return "阴离子"; } else { - return "未知类型"; + if (stuff_ion == "7") + { + return "非离子"; + } + else + { + if (stuff_ion == "8") + { + return "酞菁"; + } + else + { + if (stuff_ion == "9") + { + return "直接"; + } + + else + { + return "未知类型"; + } + } + } } } } diff --git a/Windows/Stuff.xaml b/Windows/Stuff.xaml index 122baee..6f920e4 100644 --- a/Windows/Stuff.xaml +++ b/Windows/Stuff.xaml @@ -124,13 +124,16 @@ - + + + diff --git a/Windows/Stuff.xaml.cs b/Windows/Stuff.xaml.cs index da643c1..b621047 100644 --- a/Windows/Stuff.xaml.cs +++ b/Windows/Stuff.xaml.cs @@ -178,13 +178,16 @@ namespace formula_manage.Windows else if (this.stuff_ProductType.Text == "液体染料") int_stuff_ProductType = 3; - if(stuff_ion.Text == "分散") int_stuff_ion = 0; - else if (stuff_ion.Text == "酸性") int_stuff_ion = 1; - else if (stuff_ion.Text == "活性") int_stuff_ion = 2; - else if (stuff_ion.Text == "硫化") int_stuff_ion = 3; - else if (stuff_ion.Text == "阳离子") int_stuff_ion = 4; - else if (stuff_ion.Text == "酞菁") int_stuff_ion = 5; - else if (stuff_ion.Text == "直接") int_stuff_ion = 6; + if(Stuff_ion.Text == "分散") int_stuff_ion = 0; + else if (Stuff_ion.Text == "酸性") int_stuff_ion = 1; + else if (Stuff_ion.Text == "活性") int_stuff_ion = 2; + else if (Stuff_ion.Text == "中性") int_stuff_ion = 3; + else if (Stuff_ion.Text == "硫化") int_stuff_ion = 4; + else if (Stuff_ion.Text == "阳离子") int_stuff_ion = 5; + else if (Stuff_ion.Text == "阴离子") int_stuff_ion = 6; + else if (Stuff_ion.Text == "非离子") int_stuff_ion = 7; + else if (Stuff_ion.Text == "酞菁") int_stuff_ion = 8; + else if (Stuff_ion.Text == "直接") int_stuff_ion = 9; if ((re_number.IsMatch(this.stuff_Price.Text) == false) && (stuff_Price.Text != "")) System.Windows.MessageBox.Show("ERR:价格信息错误", "错误");//检查价格输入信息 @@ -245,9 +248,10 @@ namespace formula_manage.Windows SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 - if(stuff_ion.Text !="")Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET [ProductIon_Type] ="+ int_stuff_ion + " Where ProductCode='" + Product_Code + "'"); + if (Stuff_ion.Text != "") Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET [ProductIon_Type] =" + int_stuff_ion + " Where ProductCode='" + Product_Code + "'"); + else Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET [ProductIon_Type] =NULL Where ProductCode='" + Product_Code + "'"); SqlCommand Stuff_sql_cmd = new SqlCommand(Stuff_sql, conn_SC); - INSERT_cmd.ExecuteNonQuery(); //执行语句 + Stuff_sql_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 if (sql_in == 0) @@ -270,9 +274,10 @@ namespace formula_manage.Windows SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句 - if (stuff_ion.Text != "") Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET [ProductIon_Type] =" + int_stuff_ion + " Where ProductCode='" + Product_Code + "'"); + if (Stuff_ion.Text != "") Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET [ProductIon_Type] =" + int_stuff_ion + " Where ProductCode='" + Product_Code + "'"); + else Stuff_sql = string.Format("UPDATE [dbo].[PRODUCT] SET [ProductIon_Type] =NULL Where ProductCode='" + Product_Code + "'"); SqlCommand Stuff_sql_cmd = new SqlCommand(Stuff_sql, conn_SC); - INSERT_cmd.ExecuteNonQuery(); //执行语句 + Stuff_sql_cmd.ExecuteNonQuery(); //执行语句 conn_SC.Close(); //关闭连接 if (sql_in == 0) @@ -355,7 +360,8 @@ namespace formula_manage.Windows stuff_ProductName.Text = DataGridStuff_ProductName.Trim();//原料名称,去除空白字符 stuff_Price.Text = DataGridStuff_Price;//价格 stuff_ProductType.Text = DataGridStuff_ProductType;//类型 - stuff_ion.Text = DataGridStuff_stuff_ion; + if (DataGridStuff_stuff_ion == "未知类型") Stuff_ion.Text = ""; + else Stuff_ion.Text = DataGridStuff_stuff_ion; stuff_SUPPLIER.Text = DataGridstuff_SUPPLIER;//供应商 /*stuff_Color.Text = DataGridStuff_Color;//色彩数据*/ stuff_Concentration.Text = DataGridStuff_Concentration;//浓度