添加原料离子类型项目
This commit is contained in:
commit
5bad675f46
5 files changed
+158
-40
No files matched your search
@@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace formula_manage.ConvertMoels
|
||||||
|
{
|
||||||
|
internal class IonSQLConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string stuff_ion = System.Convert.ToString(value);
|
||||||
|
if (stuff_ion == "0")//类型
|
||||||
|
{
|
||||||
|
return "分散";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "1")
|
||||||
|
{
|
||||||
|
return "酸性";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "2")
|
||||||
|
{
|
||||||
|
return "活性";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "3")
|
||||||
|
{
|
||||||
|
return "硫化";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "4")
|
||||||
|
{
|
||||||
|
return "阳离子";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "5")
|
||||||
|
{
|
||||||
|
return "酞菁";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (stuff_ion == "6")
|
||||||
|
{
|
||||||
|
return "直接";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "未知类型";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// </summary>
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-1
@@ -158,7 +158,7 @@
|
|||||||
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ComboBox x:Name="CP_PRODUCT_CODE" BorderThickness="0,0,0,0" Text="{Binding PRODUCT_CODE}" BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True" KeyDown="CP_PRODUCT_CODE_KeyUp"
|
<ComboBox x:Name="CP_PRODUCT_CODE" BorderThickness="0,0,0,0" ItemsSource="{Binding Path=STUFFdataTable}" DisplayMemberPath="{Binding ProductCode}" BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True" KeyDown="CP_PRODUCT_CODE_KeyUp"
|
||||||
>
|
>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
@@ -171,6 +171,7 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
<DataGridTemplateColumn Header="计算单位" Width="80" MaxWidth="80" MinWidth="80" CellStyle="{StaticResource CellStyle}">
|
<DataGridTemplateColumn Header="计算单位" Width="80" MaxWidth="80" MinWidth="80" CellStyle="{StaticResource CellStyle}">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
|
|||||||
+44
-22
@@ -7,12 +7,13 @@
|
|||||||
xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels"
|
xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels"
|
||||||
xmlns:viewmodel="clr-namespace:formula_manage.ViewModel"
|
xmlns:viewmodel="clr-namespace:formula_manage.ViewModel"
|
||||||
mc:Ignorable="d" Loaded="Stuff_Loaded"
|
mc:Ignorable="d" Loaded="Stuff_Loaded"
|
||||||
Title="Stuff" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
|
Title="Stuff" Height="720" Width="1200" MaxHeight="720" MaxWidth="1200" MinHeight="720" MinWidth="1200"
|
||||||
BorderBrush="White" Background="#FFE0E0E0">
|
BorderBrush="White" Background="#FFE0E0E0">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<!--引入转换器-->
|
<!--引入转换器-->
|
||||||
<ConvertMoels:ColorSQLConvert x:Key="ColorSQLConvert"/>
|
<ConvertMoels:ColorSQLConvert x:Key="ColorSQLConvert"/>
|
||||||
<ConvertMoels:ProductTypeSQLConvert x:Key="ProductTypeSQLConvert"/>
|
<ConvertMoels:ProductTypeSQLConvert x:Key="ProductTypeSQLConvert"/>
|
||||||
|
<ConvertMoels:IonSQLConvert x:Key="IonSQLConvert"/>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<!--原料表-->
|
<!--原料表-->
|
||||||
@@ -60,9 +61,7 @@
|
|||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
<DataGridTextColumn Header="原料代码" Binding="{Binding ProductCode}" Width="130" FontSize="15" MaxWidth="130" MinWidth="100" CanUserReorder="False"/>
|
<DataGridTextColumn Header="原料代码" Binding="{Binding ProductCode}" Width="130" FontSize="15" MaxWidth="130" MinWidth="100" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="原料名称" Binding="{Binding ProductName}" Width="200" FontSize="15" MaxWidth="200" MinWidth="200" CanUserReorder="False"/>
|
<DataGridTextColumn Header="原料名称" Binding="{Binding ProductName}" Width="200" FontSize="15" MaxWidth="200" MinWidth="200" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="价格(¥/kg)" Binding="{Binding Price}" Width="100" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False"/>
|
<DataGridTextColumn Header="原料类型" Width="80" FontSize="15" MaxWidth="80" MinWidth="70" CanUserReorder="False">
|
||||||
<DataGridTextColumn Header="供应商" Binding="{Binding SUPPLIER}" Width="150" FontSize="15" MaxWidth="150" MinWidth="150" CanUserReorder="False"/>
|
|
||||||
<DataGridTextColumn Header="原料类型" Width="80" FontSize="15" MaxWidth="80" MinWidth="70" CanUserReorder="False">
|
|
||||||
<!--事件名称:原料类型数字转文字显示,转换器ProductTypeSQLConvert-->
|
<!--事件名称:原料类型数字转文字显示,转换器ProductTypeSQLConvert-->
|
||||||
<DataGridTextColumn.ElementStyle>
|
<DataGridTextColumn.ElementStyle>
|
||||||
<Style TargetType="{x:Type TextBlock}">
|
<Style TargetType="{x:Type TextBlock}">
|
||||||
@@ -70,28 +69,38 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</DataGridTextColumn.ElementStyle>
|
</DataGridTextColumn.ElementStyle>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="色彩" Width="100" MaxWidth="500" MinWidth="50" CanUserReorder="False">
|
<DataGridTextColumn Header="离子类型" Width="80" FontSize="15" MaxWidth="500" MinWidth="50" CanUserReorder="False">
|
||||||
|
<!--事件名称:离子数字转显示,转换器IonSQLConvert-->
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="Text" Value="{Binding ProductIon_Type, Converter={StaticResource IonSQLConvert}}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="色彩" Width="100" MaxWidth="500" MinWidth="50" CanUserReorder="False">
|
||||||
<!--事件名称:色彩数字转色彩显示,转换器ColorSQLConvert-->
|
<!--事件名称:色彩数字转色彩显示,转换器ColorSQLConvert-->
|
||||||
<DataGridTextColumn.ElementStyle>
|
<DataGridTextColumn.ElementStyle>
|
||||||
<Style TargetType="{x:Type TextBlock}">
|
<Style TargetType="{x:Type TextBlock}">
|
||||||
<Setter Property="Background" Value="{Binding Color, Converter={StaticResource ColorSQLConvert}}"/>
|
<Setter Property="Background" Value="{Binding Color, Converter={StaticResource ColorSQLConvert}}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</DataGridTextColumn.ElementStyle>
|
</DataGridTextColumn.ElementStyle>
|
||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="浓度(%)" Binding="{Binding Concentration}" Width="70" FontSize="15" MaxWidth="200" MinWidth="20" CanUserReorder="False"/>
|
<DataGridTextColumn Header="浓度(%)" Binding="{Binding Concentration}" Width="70" FontSize="15" MaxWidth="200" MinWidth="20" CanUserReorder="False"/>
|
||||||
<DataGridTextColumn Header="比重(sg)" Binding="{Binding GRAVITY}" Width="70" FontSize="15" MaxWidth="200" MinWidth="20" CanUserReorder="False"/>
|
<DataGridTextColumn Header="比重(sg)" Binding="{Binding GRAVITY}" Width="70" FontSize="15" MaxWidth="200" MinWidth="20" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="价格(¥/kg)" Binding="{Binding Price}" Width="100" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="供应商" Binding="{Binding SUPPLIER}" Width="150" FontSize="15" MaxWidth="150" MinWidth="150" CanUserReorder="False"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<!--搜索类型-->
|
<!--搜索类型-->
|
||||||
<RadioButton Content="染料" x:Name="Button_0" Click="Radiobutton" HorizontalAlignment="Left" Height="20" Margin="995,265,0,0"
|
<RadioButton Content="染料" x:Name="Button_0" Click="Radiobutton" HorizontalAlignment="Left" Height="20" Margin="1095,265,0,0"
|
||||||
VerticalAlignment="Top" Width="100" BorderBrush="Black" Background="White" Grid.Column="1" FontSize="14" />
|
VerticalAlignment="Top" Width="100" BorderBrush="Black" Background="White" Grid.Column="1" FontSize="14" />
|
||||||
<RadioButton Content="助剂" x:Name="Button_1" Click="Radiobutton" HorizontalAlignment="Left" Height="20" Margin="995,295,0,0"
|
<RadioButton Content="助剂" x:Name="Button_1" Click="Radiobutton" HorizontalAlignment="Left" Height="20" Margin="1095,295,0,0"
|
||||||
VerticalAlignment="Top" Width="100" BorderBrush="Black" Background="White" Grid.Column="1" FontSize="14" />
|
VerticalAlignment="Top" Width="100" BorderBrush="Black" Background="White" Grid.Column="1" FontSize="14" />
|
||||||
<RadioButton Content="粉体助剂" x:Name="Button_2" Click="Radiobutton" HorizontalAlignment="Left" Height="20" Margin="995,325,0,0"
|
<RadioButton Content="粉体助剂" x:Name="Button_2" Click="Radiobutton" HorizontalAlignment="Left" Height="20" Margin="1095,325,0,0"
|
||||||
VerticalAlignment="Top" Width="100" BorderBrush="Black" Background="White" Grid.Column="1" FontSize="14"/>
|
VerticalAlignment="Top" Width="100" BorderBrush="Black" Background="White" Grid.Column="1" FontSize="14"/>
|
||||||
<RadioButton Content="液体染料" x:Name="Button_3" Click="Radiobutton" HorizontalAlignment="Left" Height="20" Margin="995,355,0,0"
|
<RadioButton Content="液体染料" x:Name="Button_3" Click="Radiobutton" HorizontalAlignment="Left" Height="20" Margin="1095,355,0,0"
|
||||||
VerticalAlignment="Top" Width="100" BorderBrush="Black" Background="White" Grid.Column="1" FontSize="14" />
|
VerticalAlignment="Top" Width="100" BorderBrush="Black" Background="White" Grid.Column="1" FontSize="14" />
|
||||||
<RadioButton Content="全部原料" x:Name="Button_all" Click="Radiobutton" HorizontalAlignment="Left" Height="20" Margin="995,385,0,0"
|
<RadioButton Content="全部原料" x:Name="Button_all" Click="Radiobutton" HorizontalAlignment="Left" Height="20" Margin="1095,385,0,0"
|
||||||
VerticalAlignment="Top" Width="100" BorderBrush="Black" Background="White" Grid.Column="1" IsChecked="True" FontSize="14" />
|
VerticalAlignment="Top" Width="100" BorderBrush="Black" Background="White" Grid.Column="1" IsChecked="True" FontSize="14" />
|
||||||
<!--原料代码-->
|
<!--原料代码-->
|
||||||
<TextBox x:Name="stuff_ProductCode" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text=""
|
<TextBox x:Name="stuff_ProductCode" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text=""
|
||||||
@@ -105,18 +114,31 @@
|
|||||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="255,0,0,100" TextWrapping="Wrap" Text="原料名称"
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="255,0,0,100" TextWrapping="Wrap" Text="原料名称"
|
||||||
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
||||||
<!--原料类型-->
|
<!--原料类型-->
|
||||||
<ComboBox x:Name="stuff_ProductType" HorizontalAlignment="Left" Height="30" Margin="645,0,0,100" Text=""
|
<ComboBox x:Name="stuff_ProductType" HorizontalAlignment="Left" Height="30" Margin="755,0,0,100" Text=""
|
||||||
VerticalAlignment="Bottom" Width="100" FontSize="16" IsReadOnly="True" IsEditable="True">
|
VerticalAlignment="Bottom" Width="100" FontSize="16" IsReadOnly="True" IsEditable="True">
|
||||||
<ComboBoxItem Content="染料"></ComboBoxItem>
|
<ComboBoxItem Content="染料"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="助剂"></ComboBoxItem>
|
<ComboBoxItem Content="助剂"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="粉体助剂"></ComboBoxItem>
|
<ComboBoxItem Content="粉体助剂"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="液体染料"></ComboBoxItem>
|
<ComboBoxItem Content="液体染料"></ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="560,0,0,100" TextWrapping="Wrap" Text="原料类型"
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="670,0,0,100" TextWrapping="Wrap" Text="原料类型"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
||||||
|
<!--离子类型-->
|
||||||
|
<ComboBox x:Name="stuff_ion" HorizontalAlignment="Left" Height="30" Margin="755,0,0,50" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="16" IsReadOnly="True" IsEditable="True">
|
||||||
|
<ComboBoxItem Content="分散"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="酸性"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="活性"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="硫化"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="阳离子"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="酞菁"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="直接"></ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="670,0,0,50" TextWrapping="Wrap" Text="离子类型"
|
||||||
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
||||||
<!--色彩-->
|
<!--色彩-->
|
||||||
<TextBox x:Name="stuff_Color" HorizontalAlignment="Left" Height="30" Margin="445,0,0,50"
|
<TextBox x:Name="stuff_Color" HorizontalAlignment="Left" Height="30" Margin="445,0,0,50"
|
||||||
VerticalAlignment="Bottom" Width="80" MaxLines="1" IsReadOnly="True" Cursor="Arrow"
|
VerticalAlignment="Bottom" Width="100" MaxLines="1" IsReadOnly="True" Cursor="Arrow"
|
||||||
MouseDoubleClick="Stuff_Color_MouseDoubleClick"/>
|
MouseDoubleClick="Stuff_Color_MouseDoubleClick"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="400,0,0,50" TextWrapping="Wrap" Text="色彩"
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="400,0,0,50" TextWrapping="Wrap" Text="色彩"
|
||||||
VerticalAlignment="Bottom" Width="50" FontSize="20"/>
|
VerticalAlignment="Bottom" Width="50" FontSize="20"/>
|
||||||
@@ -132,24 +154,24 @@
|
|||||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="255,0,0,50" TextWrapping="Wrap" Text="价格"
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="255,0,0,50" TextWrapping="Wrap" Text="价格"
|
||||||
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
<!--浓度-->
|
<!--浓度-->
|
||||||
<TextBox x:Name="stuff_Concentration" HorizontalAlignment="Left" Height="30" Margin="585,0,0,50" Text="100"
|
<TextBox x:Name="stuff_Concentration" HorizontalAlignment="Left" Height="30" Margin="605,0,0,50" Text="100"
|
||||||
VerticalAlignment="Bottom" Width="50" FontSize="22" MaxLines="1" MaxLength="7"
|
VerticalAlignment="Bottom" Width="50" FontSize="22" MaxLines="1" MaxLength="7"
|
||||||
InputMethod.IsInputMethodEnabled="False"/>
|
InputMethod.IsInputMethodEnabled="False"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="540,0,0,50" TextWrapping="Wrap" Text="浓度"
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="560,0,0,50" TextWrapping="Wrap" Text="浓度"
|
||||||
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
<!--比重-->
|
<!--比重-->
|
||||||
<TextBox x:Name="stuff_GRAVITY" HorizontalAlignment="Left" Height="30" Margin="695,0,0,50" Text="1"
|
<TextBox x:Name="stuff_GRAVITY" HorizontalAlignment="Left" Height="30" Margin="605,0,0,100" Text="1"
|
||||||
VerticalAlignment="Bottom" Width="50" FontSize="22" MaxLines="1" MaxLength="4"
|
VerticalAlignment="Bottom" Width="50" FontSize="22" MaxLines="1" MaxLength="4"
|
||||||
InputMethod.IsInputMethodEnabled="False"/>
|
InputMethod.IsInputMethodEnabled="False"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="30" Margin="650,0,0,50" TextWrapping="Wrap" Text="比重"
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="560,0,0,100" TextWrapping="Wrap" Text="比重"
|
||||||
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
<!--存储按钮-->
|
<!--存储按钮-->
|
||||||
<Button Content="存储" HorizontalAlignment="Left" Height="50" Margin="795,0,0,60"
|
<Button Content="存储" HorizontalAlignment="Left" Height="50" Margin="895,0,0,60"
|
||||||
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
||||||
Click="Button_Preservation">
|
Click="Button_Preservation">
|
||||||
</Button>
|
</Button>
|
||||||
<!--删除按钮-->
|
<!--删除按钮-->
|
||||||
<Button Content="删除" HorizontalAlignment="Left" Height="50" Margin="935,0,0,60"
|
<Button Content="删除" HorizontalAlignment="Left" Height="50" Margin="1035,0,0,60"
|
||||||
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
||||||
Click="Button_Delete">
|
Click="Button_Delete">
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
+37
-17
@@ -62,7 +62,7 @@ namespace formula_manage.Windows
|
|||||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY FROM [Dispensing].[dbo].[PRODUCT]";//查询语句
|
string Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
try
|
try
|
||||||
@@ -128,11 +128,11 @@ namespace formula_manage.Windows
|
|||||||
private async void GridSql(int e )
|
private async void GridSql(int e )
|
||||||
{
|
{
|
||||||
string Stuff_sql = null;
|
string Stuff_sql = null;
|
||||||
if (e == 0) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY FROM [Dispensing].[dbo].[PRODUCT]";//查询语句
|
if (e == 0) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT]";//查询语句
|
||||||
else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '0' ";
|
else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '0' ";
|
||||||
else if (e == 2) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '1' ";
|
else if (e == 2) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '1' ";
|
||||||
else if (e == 3) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '2' ";
|
else if (e == 3) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '2' ";
|
||||||
else if (e == 4) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '3' ";
|
else if (e == 4) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '3' ";
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
@@ -159,6 +159,7 @@ namespace formula_manage.Windows
|
|||||||
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数
|
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数
|
||||||
Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串
|
Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串
|
||||||
int int_stuff_ProductType = 0;
|
int int_stuff_ProductType = 0;
|
||||||
|
int int_stuff_ion = 0;
|
||||||
int ColorCode_SQL;
|
int ColorCode_SQL;
|
||||||
string Stuff_sql;
|
string Stuff_sql;
|
||||||
string Product_Code = stuff_ProductCode.Text.ToString();
|
string Product_Code = stuff_ProductCode.Text.ToString();
|
||||||
@@ -177,8 +178,16 @@ namespace formula_manage.Windows
|
|||||||
else if (this.stuff_ProductType.Text == "液体染料")
|
else if (this.stuff_ProductType.Text == "液体染料")
|
||||||
int_stuff_ProductType = 3;
|
int_stuff_ProductType = 3;
|
||||||
|
|
||||||
if ((re_number.IsMatch(this.stuff_Price.Text) == false)&&(stuff_Price.Text != ""))
|
if(stuff_ion.Text == "分散") int_stuff_ion = 0;
|
||||||
System.Windows.MessageBox.Show("ERR:价格信息错误", "错误");//检查价格输入信息
|
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 ((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)
|
if (re_char.IsMatch(this.stuff_ProductCode.Text) == false)
|
||||||
System.Windows.MessageBox.Show("ERR:无效的原料信息", "错误");//检查原料代码
|
System.Windows.MessageBox.Show("ERR:无效的原料信息", "错误");//检查原料代码
|
||||||
else
|
else
|
||||||
@@ -235,6 +244,11 @@ namespace formula_manage.Windows
|
|||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
||||||
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
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 + "'");
|
||||||
|
SqlCommand Stuff_sql_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
||||||
|
INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
|
||||||
conn_SC.Close(); //关闭连接
|
conn_SC.Close(); //关闭连接
|
||||||
if (sql_in == 0)
|
if (sql_in == 0)
|
||||||
{
|
{
|
||||||
@@ -255,6 +269,11 @@ namespace formula_manage.Windows
|
|||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
||||||
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
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 + "'");
|
||||||
|
SqlCommand Stuff_sql_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
||||||
|
INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
|
||||||
conn_SC.Close(); //关闭连接
|
conn_SC.Close(); //关闭连接
|
||||||
if (sql_in == 0)
|
if (sql_in == 0)
|
||||||
{
|
{
|
||||||
@@ -323,19 +342,20 @@ namespace formula_manage.Windows
|
|||||||
/*定位选中行及指定列单元格文本信息*/
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
string DataGridStuff_ProductCode = (DataGridStuff.Columns[1].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第0列,原料代码
|
string DataGridStuff_ProductCode = (DataGridStuff.Columns[1].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第0列,原料代码
|
||||||
string DataGridStuff_ProductName = (DataGridStuff.Columns[2].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第1列,原料名称
|
string DataGridStuff_ProductName = (DataGridStuff.Columns[2].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第1列,原料名称
|
||||||
string DataGridStuff_Price = (DataGridStuff.Columns[3].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第2列,价格
|
string DataGridStuff_Price = (DataGridStuff.Columns[8].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,价格
|
||||||
string DataGridstuff_SUPPLIER = (DataGridStuff.Columns[4].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第3列,供应商
|
string DataGridstuff_SUPPLIER = (DataGridStuff.Columns[9].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,供应商
|
||||||
string DataGridStuff_ProductType = (DataGridStuff.Columns[5].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第4列,类型
|
string DataGridStuff_ProductType = (DataGridStuff.Columns[3].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,类型 //string DataGridStuff_Color = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum])as TextBlock).Text;//定位,色彩
|
||||||
//string DataGridStuff_Color = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum])as TextBlock).Text;//定位第5列,色彩
|
string DataGridStuff_Concentration = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位选中行单元格文本信息
|
||||||
string DataGridStuff_Concentration = (DataGridStuff.Columns[7].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第6列选中行单元格文本信息并去除空白字符,浓度
|
string DataGridStuff_stuff_ion = (DataGridStuff.Columns[4].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位选中行单元格文本信息并去除空白字符,浓度
|
||||||
string DataGridStuff_GRAVITY = (DataGridStuff.Columns[8].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第7列,比重
|
string DataGridStuff_GRAVITY = (DataGridStuff.Columns[7].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位,比重
|
||||||
/*stuff_Color.Background = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background;//定位第5列,色彩,背景色传递至色彩框背景色*/
|
/*stuff_Color.Background = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background;//定位,色彩,背景色传递至色彩框背景色*/
|
||||||
/*填写信息至指定文本框*/
|
/*填写信息至指定文本框*/
|
||||||
//product_temp.ProductCode = DataGridStuff_ProductCode;//写入sql实体缓存
|
//product_temp.ProductCode = DataGridStuff_ProductCode;//写入sql实体缓存
|
||||||
stuff_ProductCode.Text = DataGridStuff_ProductCode.Trim();//原料代码,去除空白字符
|
stuff_ProductCode.Text = DataGridStuff_ProductCode.Trim();//原料代码,去除空白字符
|
||||||
stuff_ProductName.Text = DataGridStuff_ProductName.Trim();//原料名称,去除空白字符
|
stuff_ProductName.Text = DataGridStuff_ProductName.Trim();//原料名称,去除空白字符
|
||||||
stuff_Price.Text = DataGridStuff_Price;//价格
|
stuff_Price.Text = DataGridStuff_Price;//价格
|
||||||
stuff_ProductType.Text = DataGridStuff_ProductType;//类型
|
stuff_ProductType.Text = DataGridStuff_ProductType;//类型
|
||||||
|
stuff_ion.Text = DataGridStuff_stuff_ion;
|
||||||
stuff_SUPPLIER.Text = DataGridstuff_SUPPLIER;//供应商
|
stuff_SUPPLIER.Text = DataGridstuff_SUPPLIER;//供应商
|
||||||
/*stuff_Color.Text = DataGridStuff_Color;//色彩数据*/
|
/*stuff_Color.Text = DataGridStuff_Color;//色彩数据*/
|
||||||
stuff_Concentration.Text = DataGridStuff_Concentration;//浓度
|
stuff_Concentration.Text = DataGridStuff_Concentration;//浓度
|
||||||
@@ -343,9 +363,9 @@ namespace formula_manage.Windows
|
|||||||
/*if (DataGridStuff_ProductType.ToString() == "0") stuff_ProductType.Text = "染料";//判断类型1-染料。2-助剂。3-粉体助剂。
|
/*if (DataGridStuff_ProductType.ToString() == "0") stuff_ProductType.Text = "染料";//判断类型1-染料。2-助剂。3-粉体助剂。
|
||||||
if (DataGridStuff_ProductType.ToString() == "1") stuff_ProductType.Text = "助剂";
|
if (DataGridStuff_ProductType.ToString() == "1") stuff_ProductType.Text = "助剂";
|
||||||
if (DataGridStuff_ProductType.ToString() == "2") stuff_ProductType.Text = "粉体助剂";*/
|
if (DataGridStuff_ProductType.ToString() == "2") stuff_ProductType.Text = "粉体助剂";*/
|
||||||
if ((DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background != null) //定位第5列选中行单元格,色彩,判断参数是否有效
|
if ((DataGridStuff.Columns[5].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background != null) //定位选中行单元格,色彩,判断参数是否有效
|
||||||
{
|
{
|
||||||
stuff_Color.Background = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background; //定位第5列选中行单元格,色彩,有效背景色传递至色彩框背景色
|
stuff_Color.Background = (DataGridStuff.Columns[5].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background; //定位选中行单元格,色彩,有效背景色传递至色彩框背景色
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -166,6 +166,7 @@
|
|||||||
<Compile Include="ConvertMoels\DeviationConvert.cs" />
|
<Compile Include="ConvertMoels\DeviationConvert.cs" />
|
||||||
<Compile Include="ConvertMoels\GramsSQLConvert.cs" />
|
<Compile Include="ConvertMoels\GramsSQLConvert.cs" />
|
||||||
<Compile Include="ConvertMoels\IndustrySQLConvert.cs" />
|
<Compile Include="ConvertMoels\IndustrySQLConvert.cs" />
|
||||||
|
<Compile Include="ConvertMoels\IonSQLConvert.cs" />
|
||||||
<Compile Include="ConvertMoels\ProductTypeSQLConvert.cs" />
|
<Compile Include="ConvertMoels\ProductTypeSQLConvert.cs" />
|
||||||
<Compile Include="ConvertMoels\StatenConvert.cs" />
|
<Compile Include="ConvertMoels\StatenConvert.cs" />
|
||||||
<Compile Include="ConvertMoels\StatenERRConvert.cs" />
|
<Compile Include="ConvertMoels\StatenERRConvert.cs" />
|
||||||
|
|||||||
Reference in new issue
Block a user