Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage
This commit is contained in:
commit
e4ea1d3d51
2 files changed
+31
-27
No files matched your search
+1
-2
@@ -121,8 +121,7 @@
|
||||
VerticalAlignment="Bottom" Width="50" FontSize="20"/>
|
||||
<!--供应商-->
|
||||
<TextBox x:Name="stuff_SUPPLIER" HorizontalAlignment="Left" Height="30" Margin="105,0,0,50" Text=""
|
||||
VerticalAlignment="Bottom" Width="130" FontSize="22" MaxLines="1" MaxLength="25"
|
||||
InputMethod.IsInputMethodEnabled="False"/>
|
||||
VerticalAlignment="Bottom" Width="130" FontSize="22" MaxLines="1" MaxLength="25"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="供应商"
|
||||
VerticalAlignment="Bottom" Width="80" FontSize="20"/>
|
||||
<!--价格-->
|
||||
|
||||
+30
-25
@@ -131,12 +131,12 @@ namespace formula_manage.Windows
|
||||
int int_stuff_ProductType = 0;
|
||||
int ColorCode_SQL;
|
||||
string Stuff_sql;
|
||||
string Product_Code = stuff_ProductCode.Text;
|
||||
string Product_Name = stuff_ProductName.Text;
|
||||
string _Price = stuff_Price.Text;
|
||||
string _SUPPLIER = stuff_SUPPLIER.Text;
|
||||
string _Concentration = stuff_Concentration.Text;
|
||||
string _GRAVITY = stuff_GRAVITY.Text;
|
||||
string Product_Code = stuff_ProductCode.Text.ToString();
|
||||
string Product_Name = stuff_ProductName.Text.ToString();
|
||||
string _Price = stuff_Price.Text.ToString();
|
||||
string _SUPPLIER = stuff_SUPPLIER.Text.ToString();
|
||||
string _Concentration = stuff_Concentration.Text.ToString();
|
||||
string _GRAVITY = stuff_GRAVITY.Text.ToString();
|
||||
|
||||
if (this.stuff_ProductType.Text == "染料") //原料类型0。染料,1助剂,2粉体
|
||||
int_stuff_ProductType = 0;
|
||||
@@ -147,32 +147,36 @@ namespace formula_manage.Windows
|
||||
else if (this.stuff_ProductType.Text == "液体染料")
|
||||
int_stuff_ProductType = 3;
|
||||
|
||||
|
||||
if ((re_number.IsMatch(this.stuff_Price.Text) == false)&&(stuff_Price.Text != ""))
|
||||
System.Windows.MessageBox.Show("ERR:价格信息错误", "错误");//检查价格输入信息
|
||||
if (re_char.IsMatch(this.stuff_ProductCode.Text) == false)
|
||||
System.Windows.MessageBox.Show("ERR.C0101:无效的原料信息", "错误");//检查原料代码
|
||||
System.Windows.MessageBox.Show("ERR:无效的原料信息", "错误");//检查原料代码
|
||||
else
|
||||
if (string.IsNullOrEmpty(this.stuff_ProductName.Text))
|
||||
System.Windows.MessageBox.Show("ERR.C0101-2:无效的原料信息", "错误");//检查原料名称
|
||||
System.Windows.MessageBox.Show("ERR:无效的原料名称", "错误");//检查原料名称
|
||||
else
|
||||
if (string.IsNullOrEmpty(this.stuff_ProductType.Text))
|
||||
System.Windows.MessageBox.Show("ERR.C0101-3:无效的原料信息", "错误");//检查原料类型
|
||||
System.Windows.MessageBox.Show("ERR:无效的原料类型", "错误");//检查原料类型
|
||||
else
|
||||
if (string.IsNullOrEmpty(this.stuff_GRAVITY.Text))
|
||||
System.Windows.MessageBox.Show("ERR.C0101-1:无效的原料信息", "错误");//检查原料比重
|
||||
System.Windows.MessageBox.Show("ERR:无效的比重", "错误");//检查原料比重
|
||||
else
|
||||
if (re_number.IsMatch(this.stuff_GRAVITY.Text) == false)
|
||||
System.Windows.MessageBox.Show("ERR.C0102-1:原料信息错误", "错误");//检查比重输入信息
|
||||
System.Windows.MessageBox.Show("ERR:比重信息错误", "错误");//检查比重输入信息
|
||||
else
|
||||
if (re_number.IsMatch(this.stuff_Concentration.Text) == false)
|
||||
System.Windows.MessageBox.Show("ERR.C0102-3:原料信息错误", "错误");//检查浓度输入信息
|
||||
System.Windows.MessageBox.Show("ERR:浓度错误", "错误");//检查浓度输入信息
|
||||
else
|
||||
if (float.Parse(this.stuff_GRAVITY.Text) < 0 || float.Parse(this.stuff_GRAVITY.Text) > 5)
|
||||
System.Windows.MessageBox.Show("ERR.C0102-2:原料信息错误", "错误");//检查比重输入数值
|
||||
System.Windows.MessageBox.Show("ERR:比重错误", "错误");//检查比重输入数值
|
||||
else
|
||||
if (float.Parse(this.stuff_Concentration.Text) < 0 || float.Parse(this.stuff_Concentration.Text) > 100)
|
||||
System.Windows.MessageBox.Show("ERR.C0102-4:原料信息错误", "错误");//检查浓度输入数值
|
||||
System.Windows.MessageBox.Show("ERR:浓度错误", "错误");//检查浓度输入数值
|
||||
else
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (int_stuff_ProductType == 0 || int_stuff_ProductType == 3)//判断是否为染料,非染料写空
|
||||
{
|
||||
string colorValue = stuff_Color.Background.ToString();//获取色彩框背景色"#FFC1C2C3"
|
||||
@@ -188,30 +192,31 @@ namespace formula_manage.Windows
|
||||
ColorCode_SQL = 16777215;
|
||||
}
|
||||
|
||||
if (stuff_SUPPLIER.Text == null) _SUPPLIER = "null";
|
||||
if (stuff_Price.Text == null) _Price = "null";
|
||||
|
||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||
Stuff_sql = "SELECT ProductCode FROM [Dispensing].[dbo].[PRODUCT] WHERE ProductCode = '" + Product_Code + " '";//查询语句
|
||||
|
||||
await conn_SC.OpenAsync(); //打开数据连接
|
||||
await conn_SC.OpenAsync(); //打开数据连
|
||||
SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数
|
||||
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||
conn_SC.Close(); //关闭连接
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
Stuff_sql = "INSERT INTO[Dispensing].[dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " +
|
||||
"VALUES (" + Product_Code + "," + Product_Name + "," + _Price + "," + _SUPPLIER + "," + int_stuff_ProductType + "," + ColorCode_SQL + "," + _Concentration + "," + _GRAVITY + ")";
|
||||
|
||||
Stuff_sql = string.Format( "INSERT INTO[Dispensing].[dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " +
|
||||
"VALUES ('" + Product_Code + "','" + Product_Name + "','" + _Price + "','" + _SUPPLIER + "','" + int_stuff_ProductType + "','" + ColorCode_SQL + "','" + _Concentration + "','" + _GRAVITY + "')");
|
||||
await conn_SC.OpenAsync(); //打开数据连接
|
||||
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数
|
||||
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC); //执行语句
|
||||
int INSERT_count = Convert.ToInt32(INSERT_cmd.ExecuteScalar()); //显示记录数
|
||||
conn_SC.Close(); //关闭连接
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
System.Windows.MessageBox.Show("请求原料信息失败,检查连接");
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* else
|
||||
|
||||
Reference in new issue
Block a user