7 changed files with 280 additions and 4 deletions
@ -0,0 +1,36 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Globalization; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace formula_manage.ConvertMoels |
||||
|
{ |
||||
|
internal class ColorSQLConvert |
||||
|
{ |
||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
||||
|
{ |
||||
|
if (value != null) |
||||
|
{ |
||||
|
string colorValue = string.Format("{0:X6}", value);//十进制RGB数值转十六进制六位RGB并补0位例“C0C0C0”
|
||||
|
/*string StuffColor = "#FF" + colorValue;//RGB数值拼接为ARGB数值(正向)*/ |
||||
|
string StuffColor_B = colorValue.Substring(0, 2);//获取蓝色参数
|
||||
|
string StuffColor_G = colorValue.Substring(2, 2);//获取绿色参数
|
||||
|
string StuffColor_R = colorValue.Substring(4, 2);//获取红色参数
|
||||
|
string StuffColor = "#FF" + StuffColor_R + StuffColor_G + StuffColor_B;//RGB数值拼接为ARGB数值
|
||||
|
return StuffColor;//返回RGB数值例“#FFC0C0C0”
|
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
return null;//返回空
|
||||
|
} |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// </summary>
|
||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
||||
|
{ |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,54 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Globalization; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace formula_manage.ConvertMoels |
||||
|
{ |
||||
|
internal class ProductTypeSQLConvert |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// </summary>
|
||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
||||
|
{ |
||||
|
string ProductType = System.Convert.ToString(value); |
||||
|
if (ProductType == "0")//类型0:染料,1:助剂,2:粉体助剂,3:液体染料,其它:未知
|
||||
|
{ |
||||
|
return "染料"; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
if (ProductType == "1") |
||||
|
{ |
||||
|
return "助剂"; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
if (ProductType == "2") |
||||
|
{ |
||||
|
return "粉体助剂"; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
if (ProductType == "3") |
||||
|
{ |
||||
|
return "液体染料"; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
return "未知类型"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// </summary>
|
||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
||||
|
{ |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,146 @@ |
|||||
|
<Window x:Class="formula_manage.Windows.Stuff" |
||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
|
xmlns:local="clr-namespace:formula_manage.Windows" |
||||
|
mc:Ignorable="d" |
||||
|
Title="Stuff" Height="720" Width="1280" BorderBrush="White" Background="#FFE0E0E0"> |
||||
|
|
||||
|
<Grid> |
||||
|
<!--原料表--> |
||||
|
<DataGrid x:Name="DataGridStuff" SelectionMode="Single" AlternationCount="2" IsReadOnly="True" |
||||
|
HorizontalAlignment="Left" Margin="15,15,0,150" d:ItemsSource="{d:SampleData ItemCount=200}" AutoGenerateColumns="False" MinColumnWidth="30" |
||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC" |
||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" CanUserReorderColumns="False"> |
||||
|
<DataGrid.RowStyle > |
||||
|
<Style TargetType="{x:Type DataGridRow}"> |
||||
|
<Style.Triggers> |
||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="0"> |
||||
|
<Setter Property="Background" Value="#FFFFFFFF" /> |
||||
|
</Trigger> |
||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="1"> |
||||
|
<Setter Property="Background" Value="#FFF5F5F5" /> |
||||
|
</Trigger> |
||||
|
<Trigger Property="IsMouseOver" Value="False"> |
||||
|
</Trigger> |
||||
|
</Style.Triggers> |
||||
|
</Style> |
||||
|
</DataGrid.RowStyle> |
||||
|
<DataGrid.CellStyle> |
||||
|
<Style TargetType="DataGridCell"> |
||||
|
<Setter Property="BorderThickness" Value="0"/> |
||||
|
<Setter Property="MinWidth" Value="20"/> |
||||
|
<Style.Triggers> |
||||
|
<Trigger Property="IsSelected" Value="True"> |
||||
|
<Setter Property="Background" Value="#FFC0C0C0"/> |
||||
|
<Setter Property="BorderBrush" Value="#FFC0C0C0"/> |
||||
|
<Setter Property="Foreground" Value="#000000"/> |
||||
|
</Trigger> |
||||
|
</Style.Triggers> |
||||
|
</Style> |
||||
|
</DataGrid.CellStyle> |
||||
|
<DataGrid.Columns> |
||||
|
<!--列信息绑定--> |
||||
|
<DataGridTemplateColumn Header=" 序号" Width="50" MinWidth="10" IsReadOnly="True"> |
||||
|
<DataGridTemplateColumn.CellTemplate> |
||||
|
<DataTemplate> |
||||
|
<TextBlock FontSize="15" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock> |
||||
|
</DataTemplate> |
||||
|
</DataGridTemplateColumn.CellTemplate> |
||||
|
</DataGridTemplateColumn> |
||||
|
<DataGridTextColumn Header="原料代码" Width="130" FontSize="15" MaxWidth="130" MinWidth="100" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="原料名称" Width="200" FontSize="15" MaxWidth="200" MinWidth="200" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="价格(¥/kg)" Width="100" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="供应商" Width="150" FontSize="15" MaxWidth="150" MinWidth="150" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="原料类型" Width="80" FontSize="15" MaxWidth="80" MinWidth="70" CanUserReorder="False"> |
||||
|
<!--事件名称:原料类型数字转文字显示,转换器ProductTypeSQLConvert--> |
||||
|
<DataGridTextColumn.ElementStyle> |
||||
|
<Style TargetType="{x:Type TextBlock}"> |
||||
|
|
||||
|
</Style> |
||||
|
</DataGridTextColumn.ElementStyle> |
||||
|
</DataGridTextColumn> |
||||
|
<DataGridTextColumn Header="色彩" Width="100" MaxWidth="500" MinWidth="50" CanUserReorder="False"> |
||||
|
<!--事件名称:色彩数字转色彩显示,转换器ColorSQLConvert--> |
||||
|
<DataGridTextColumn.ElementStyle> |
||||
|
<Style TargetType="{x:Type TextBlock}"> |
||||
|
</Style> |
||||
|
</DataGridTextColumn.ElementStyle> |
||||
|
</DataGridTextColumn> |
||||
|
<DataGridTextColumn Header="浓度(%)" Width="70" FontSize="15" MaxWidth="200" MinWidth="20" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="比重(sg)" Width="70" FontSize="15" MaxWidth="200" MinWidth="20" CanUserReorder="False"/> |
||||
|
</DataGrid.Columns> |
||||
|
</DataGrid> |
||||
|
<!--搜索类型--> |
||||
|
<!-- <RadioButton Content="染料" x:Name="Button_0" Click="Radiobutton" HorizontalAlignment="Left" Height="40" Margin="995,265,0,0" |
||||
|
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1"/> |
||||
|
<RadioButton Content="助剂" x:Name="Button_1" Click="Radiobutton" HorizontalAlignment="Left" Height="40" Margin="995,305,0,0" |
||||
|
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1"/> |
||||
|
<RadioButton Content="粉体助剂" x:Name="Button_2" Click="Radiobutton" HorizontalAlignment="Left" Height="40" Margin="995,345,0,0" |
||||
|
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1"/> |
||||
|
<RadioButton Content="液体染料" x:Name="Button_3" Click="Radiobutton" HorizontalAlignment="Left" Height="40" Margin="995,385,0,0" |
||||
|
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1"/> |
||||
|
<RadioButton Content="全部原料" x:Name="Button_all" Click="Radiobutton" HorizontalAlignment="Left" Height="40" Margin="995,425,0,0" |
||||
|
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1" IsChecked="True"/>--> |
||||
|
<!--原料代码--> |
||||
|
<TextBox x:Name="stuff_ProductCode" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text="" |
||||
|
VerticalAlignment="Bottom" Width="130" FontSize="16" MaxLines="1" MaxLength="25" |
||||
|
InputMethod.IsInputMethodEnabled="False"/> |
||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="原料代码" |
||||
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/> |
||||
|
<!--原料名称--> |
||||
|
<TextBox x:Name="stuff_ProductName" HorizontalAlignment="Left" Height="30" Margin="345,0,0,100" Text="" |
||||
|
VerticalAlignment="Bottom" Width="200" FontSize="16" MaxLines="1" MaxLength="50"/> |
||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="255,0,0,100" TextWrapping="Wrap" Text="原料名称" |
||||
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/> |
||||
|
<!--原料类型--> |
||||
|
<ComboBox x:Name="stuff_ProductType" HorizontalAlignment="Left" Height="30" Margin="645,0,0,100" Text="" |
||||
|
VerticalAlignment="Bottom" Width="100" FontSize="16" IsReadOnly="True" IsEditable="True"> |
||||
|
<ComboBoxItem Content="染料"></ComboBoxItem> |
||||
|
<ComboBoxItem Content="助剂"></ComboBoxItem> |
||||
|
<ComboBoxItem Content="粉体助剂"></ComboBoxItem> |
||||
|
<ComboBoxItem Content="液体染料"></ComboBoxItem> |
||||
|
</ComboBox> |
||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="560,0,0,100" TextWrapping="Wrap" Text="原料类型" |
||||
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/> |
||||
|
<!--色彩--> |
||||
|
<TextBox x:Name="stuff_Color" HorizontalAlignment="Left" Height="30" Margin="445,0,0,50" |
||||
|
VerticalAlignment="Bottom" Width="80" MaxLines="1" IsReadOnly="True" Cursor="Arrow"/> |
||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="400,0,0,50" TextWrapping="Wrap" Text="色彩" |
||||
|
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="16" MaxLines="1" MaxLength="25" |
||||
|
InputMethod.IsInputMethodEnabled="False"/> |
||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="供应商" |
||||
|
VerticalAlignment="Bottom" Width="80" FontSize="20"/> |
||||
|
<!--价格--> |
||||
|
<TextBox x:Name="stuff_Price" HorizontalAlignment="Left" Height="30" Margin="305,0,0,50" Text="" |
||||
|
VerticalAlignment="Bottom" Width="80" FontSize="16" MaxLines="1" MaxLength="25" |
||||
|
InputMethod.IsInputMethodEnabled="False"/> |
||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="255,0,0,50" TextWrapping="Wrap" Text="价格" |
||||
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/> |
||||
|
<!--浓度--> |
||||
|
<TextBox x:Name="stuff_Concentration" HorizontalAlignment="Left" Height="30" Margin="585,0,0,50" Text="100" |
||||
|
VerticalAlignment="Bottom" Width="50" FontSize="16" MaxLines="1" MaxLength="5" |
||||
|
InputMethod.IsInputMethodEnabled="False"/> |
||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="540,0,0,50" TextWrapping="Wrap" Text="浓度" |
||||
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/> |
||||
|
<!--比重--> |
||||
|
<TextBox x:Name="stuff_GRAVITY" HorizontalAlignment="Left" Height="30" Margin="695,0,0,50" Text="1" |
||||
|
VerticalAlignment="Bottom" Width="50" FontSize="16" MaxLines="1" MaxLength="4" |
||||
|
InputMethod.IsInputMethodEnabled="False"/> |
||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="650,0,0,50" TextWrapping="Wrap" Text="比重" |
||||
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/> |
||||
|
<!--存储按钮--> |
||||
|
<!-- <Button Content="存储" HorizontalAlignment="Left" Height="65" Margin="795,0,0,60" |
||||
|
VerticalAlignment="Bottom" Width="145" FontSize="40" BorderBrush="{x:Null}" Background="#FFEFEFEF" |
||||
|
Click="Button_Preservation"> |
||||
|
</Button> --> |
||||
|
<!--删除按钮--> |
||||
|
<!-- <Button Content="删除" HorizontalAlignment="Left" Height="65" Margin="975,0,0,60" |
||||
|
VerticalAlignment="Bottom" Width="145" FontSize="40" BorderBrush="{x:Null}" Background="#FFEFEFEF" |
||||
|
Click="Button_Delete"> </Button> --> |
||||
|
</Grid> |
||||
|
</Window> |
||||
@ -0,0 +1,27 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Windows; |
||||
|
using System.Windows.Controls; |
||||
|
using System.Windows.Data; |
||||
|
using System.Windows.Documents; |
||||
|
using System.Windows.Input; |
||||
|
using System.Windows.Media; |
||||
|
using System.Windows.Media.Imaging; |
||||
|
using System.Windows.Shapes; |
||||
|
|
||||
|
namespace formula_manage.Windows |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Stuff.xaml 的交互逻辑
|
||||
|
/// </summary>
|
||||
|
public partial class Stuff : Window |
||||
|
{ |
||||
|
public Stuff() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue