增加溶解流程设置
This commit is contained in:
commit
057a9dde63
7 files changed
+420
-28
No files matched your search
+2
-2
@@ -92,7 +92,7 @@
|
|||||||
<Button Content="-" HorizontalAlignment="Left" Height="15" Width="20" Margin="140,20,0,0" VerticalAlignment="Top" FontSize="10"
|
<Button Content="-" HorizontalAlignment="Left" Height="15" Width="20" Margin="140,20,0,0" VerticalAlignment="Top" FontSize="10"
|
||||||
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" IsTabStop="False" Click="Button_StepDow" Focusable ="False"/>
|
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" IsTabStop="False" Click="Button_StepDow" Focusable ="False"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="170,5,0,0" TextWrapping="Wrap" Text="流程:" VerticalAlignment="Top" Width="45" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="170,5,0,0" TextWrapping="Wrap" Text="流程:" VerticalAlignment="Top" Width="45" FontSize="20"/>
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="225,5,0,0" Text="" VerticalAlignment="Top" Width="175" FontSize="20" IsEditable="True" Grid.ColumnSpan="2"/>
|
<ComboBox Name="Workflow" DisplayMemberPath="DissolveName" HorizontalAlignment="Left" Height="30" Margin="225,5,0,0" Text="" VerticalAlignment="Top" Width="175" FontSize="20" IsEditable="True" Grid.ColumnSpan="2"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,40,0,0" TextWrapping="Wrap" Text="配方代码:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,40,0,0" TextWrapping="Wrap" Text="配方代码:" VerticalAlignment="Top" Width="90" FontSize="20"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="90,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20" KeyUp="SearchBox_OnKeyDownd"/>
|
<TextBox HorizontalAlignment="Left" Height="30" Margin="90,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20" KeyUp="SearchBox_OnKeyDownd"/>
|
||||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="225,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="140" FontSize="20" Focusable ="False" Grid.ColumnSpan="2"/>
|
<TextBox HorizontalAlignment="Left" Height="30" Margin="225,40,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="140" FontSize="20" Focusable ="False" Grid.ColumnSpan="2"/>
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
</DataGrid.Resources>
|
</DataGrid.Resources>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<!--列信息绑定-->
|
<!--列信息绑定-->
|
||||||
<DataGridTextColumn Header="序列" Width="50" FontSize="15" MaxWidth="50" MinWidth="50" Binding="{Binding ID}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
<DataGridTextColumn Header="序" Width="30" FontSize="15" MaxWidth="30" MinWidth="30" Binding="{Binding ID}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
||||||
<DataGridTextColumn Header="步骤" Width="50" FontSize="15" MaxWidth="50" MinWidth="50" Binding="{Binding STEP}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
<DataGridTextColumn Header="步骤" Width="50" FontSize="15" MaxWidth="50" MinWidth="50" Binding="{Binding STEP}" IsReadOnly="True" CellStyle="{StaticResource CellStyle}"/>
|
||||||
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
|||||||
+27
-22
@@ -35,6 +35,7 @@ namespace formula_manage
|
|||||||
{
|
{
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
|
|
||||||
|
DataTable DissolvedataTable = new DataTable(); //建立Dissolve缓存
|
||||||
DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存
|
DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存
|
||||||
DataTable MACHINEdataTable = new DataTable(); //建立Machine缓存
|
DataTable MACHINEdataTable = new DataTable(); //建立Machine缓存
|
||||||
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
|
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
|
||||||
@@ -59,6 +60,26 @@ namespace formula_manage
|
|||||||
|
|
||||||
USER.Text = App.USER_Purview;
|
USER.Text = App.USER_Purview;
|
||||||
|
|
||||||
|
RecipedataTable.Columns.Add("DYELOT", typeof(int));
|
||||||
|
RecipedataTable.Columns.Add("STEP", typeof(string));
|
||||||
|
RecipedataTable.Columns.Add("PRODUCT_CODE", typeof(string));
|
||||||
|
RecipedataTable.Columns.Add("CONC", typeof(string));
|
||||||
|
RecipedataTable.Columns.Add("SHIFT", typeof(string));
|
||||||
|
RecipedataTable.Columns.Add("PRODUCT_NAME", typeof(string));
|
||||||
|
RecipedataTable.Columns.Add("TARGET_WT", typeof(float));
|
||||||
|
RecipedataTable.Columns.Add("UNIT", typeof(string));
|
||||||
|
RecipedataTable.Columns.Add("REMARK", typeof(string));
|
||||||
|
|
||||||
|
RRODUCTdataTable.Columns.Add("ID", typeof(int));
|
||||||
|
RRODUCTdataTable.Columns.Add("STEP", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("PRODUCT_CODE", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("CONC", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("SHIFT", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("PRODUCT_NAME", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("TARGET_WT", typeof(float));
|
||||||
|
RRODUCTdataTable.Columns.Add("UNIT", typeof(string));
|
||||||
|
RRODUCTdataTable.Columns.Add("REMARK", typeof(string));
|
||||||
|
|
||||||
if (USER.Text =="ENGINEER") //工程师允许功能
|
if (USER.Text =="ENGINEER") //工程师允许功能
|
||||||
{
|
{
|
||||||
_SQL.IsEnabled = true;
|
_SQL.IsEnabled = true;
|
||||||
@@ -81,27 +102,6 @@ namespace formula_manage
|
|||||||
Permissions_(); //权限管理
|
Permissions_(); //权限管理
|
||||||
CountDown();//执行循环方法
|
CountDown();//执行循环方法
|
||||||
|
|
||||||
RecipedataTable.Columns.Add("DYELOT", typeof(int));
|
|
||||||
RecipedataTable.Columns.Add("STEP", typeof(string));
|
|
||||||
RecipedataTable.Columns.Add("PRODUCT_CODE", typeof(string));
|
|
||||||
RecipedataTable.Columns.Add("PRODUCT_CODE", typeof(string));
|
|
||||||
RecipedataTable.Columns.Add("CONC", typeof(string));
|
|
||||||
RecipedataTable.Columns.Add("SHIFT", typeof(string));
|
|
||||||
RecipedataTable.Columns.Add("PRODUCT_NAME", typeof(string));
|
|
||||||
RecipedataTable.Columns.Add("TARGET_WT", typeof(float));
|
|
||||||
RecipedataTable.Columns.Add("UNIT", typeof(string));
|
|
||||||
RecipedataTable.Columns.Add("REMARK", typeof(string));
|
|
||||||
|
|
||||||
RRODUCTdataTable.Columns.Add("ID", typeof(int));
|
|
||||||
RRODUCTdataTable.Columns.Add("STEP", typeof(string));
|
|
||||||
RRODUCTdataTable.Columns.Add("PRODUCT_CODE", typeof(string));
|
|
||||||
RRODUCTdataTable.Columns.Add("CONC", typeof(string));
|
|
||||||
RRODUCTdataTable.Columns.Add("SHIFT", typeof(string));
|
|
||||||
RRODUCTdataTable.Columns.Add("PRODUCT_NAME", typeof(string));
|
|
||||||
RRODUCTdataTable.Columns.Add("TARGET_WT", typeof(float));
|
|
||||||
RRODUCTdataTable.Columns.Add("UNIT", typeof(string));
|
|
||||||
RRODUCTdataTable.Columns.Add("REMARK", typeof(string));
|
|
||||||
|
|
||||||
DataRow row = RRODUCTdataTable.NewRow(); //ID列
|
DataRow row = RRODUCTdataTable.NewRow(); //ID列
|
||||||
row["ID"] = ID_N;
|
row["ID"] = ID_N;
|
||||||
row["STEP"] = Procedures_P.Text;
|
row["STEP"] = Procedures_P.Text;
|
||||||
@@ -187,6 +187,7 @@ namespace formula_manage
|
|||||||
|
|
||||||
string Stuff_sql = "SELECT ProductCode ,ProductName ,ProductType ,Concentration FROM [Dispensing].[dbo].[PRODUCT] order by ProductCode asc";//查询STUFF语句
|
string Stuff_sql = "SELECT ProductCode ,ProductName ,ProductType ,Concentration FROM [Dispensing].[dbo].[PRODUCT] order by ProductCode asc";//查询STUFF语句
|
||||||
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [Dispensing].[dbo].[MACHINE] order by Name asc";//查询machine语句
|
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [Dispensing].[dbo].[MACHINE] order by Name asc";//查询machine语句
|
||||||
|
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,MaterialType ,WeightMIN ,WeightMAX REMARK FROM [Dispensing].[dbo].[Dissolve]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
try
|
try
|
||||||
@@ -194,9 +195,11 @@ namespace formula_manage
|
|||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlDataAdapter Stuff_data = new SqlDataAdapter(Stuff_sql, Connstr_SC); //查询stuff
|
SqlDataAdapter Stuff_data = new SqlDataAdapter(Stuff_sql, Connstr_SC); //查询stuff
|
||||||
SqlDataAdapter Mac_data = new SqlDataAdapter(MAC_sql, Connstr_SC); //查询machine
|
SqlDataAdapter Mac_data = new SqlDataAdapter(MAC_sql, Connstr_SC); //查询machine
|
||||||
|
SqlDataAdapter Dissolve_data = new SqlDataAdapter(Dissolve_sql, Connstr_SC); //查询Dissolve
|
||||||
|
|
||||||
Stuff_data.Fill(STUFFdataTable); //stuff查询结果存入缓存
|
Stuff_data.Fill(STUFFdataTable); //stuff查询结果存入缓存
|
||||||
Mac_data.Fill(MACHINEdataTable); //machine查询结果存入缓存
|
Mac_data.Fill(MACHINEdataTable); //machine查询结果存入缓存
|
||||||
|
Dissolve_data.Fill(DissolvedataTable); //machine查询结果存入缓存
|
||||||
|
|
||||||
conn_SC.Close(); //关闭连接
|
conn_SC.Close(); //关闭连接
|
||||||
//DataGridStuff.ItemsSource = dataTable.DefaultView; //数据加入表格
|
//DataGridStuff.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
@@ -208,6 +211,7 @@ namespace formula_manage
|
|||||||
}
|
}
|
||||||
|
|
||||||
Machine.ItemsSource = MACHINEdataTable.DefaultView; // MACHINEdataTable数据集传递到ComboBox:machine
|
Machine.ItemsSource = MACHINEdataTable.DefaultView; // MACHINEdataTable数据集传递到ComboBox:machine
|
||||||
|
Workflow.ItemsSource = DissolvedataTable.DefaultView; // DissolvedataTable数据集传递到ComboBox:Workflow
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Permissions_()
|
private async void Permissions_()
|
||||||
@@ -435,7 +439,8 @@ namespace formula_manage
|
|||||||
|
|
||||||
private void WORKFLOW(object sender, RoutedEventArgs e)
|
private void WORKFLOW(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Windows.Dissolve dissolve = new Windows.Dissolve();
|
||||||
|
dissolve.ShowDialog();//实例化并置顶打开设置窗口
|
||||||
}
|
}
|
||||||
|
|
||||||
private void print(object sender, RoutedEventArgs e)
|
private void print(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -0,0 +1,131 @@
|
|||||||
|
<Window x:Class="formula_manage.Windows.Dissolve"
|
||||||
|
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"
|
||||||
|
xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels"
|
||||||
|
xmlns:viewmodel="clr-namespace:formula_manage.ViewModel"
|
||||||
|
mc:Ignorable="d" Loaded="Dissolve_Loaded"
|
||||||
|
Title="Dissolve_SET" Height="720" Width="1100" MaxHeight="720" MaxWidth="1100" MinHeight="720" MinWidth="1100"
|
||||||
|
BorderBrush="White" Background="#FFE0E0E0">
|
||||||
|
<Window.Resources>
|
||||||
|
<!--引入转换器-->
|
||||||
|
<ConvertMoels:IonSQLConvert x:Key="IonSQLConvert"/>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<!--设备表-->
|
||||||
|
<DataGrid x:Name="DatagridDissolve" MouseDoubleClick="Dissolve_MouseDoubleClick" SelectionMode="Single" AlternationCount="2" IsReadOnly="True"
|
||||||
|
Margin="15,15,15,150" d:ItemsSource="{d:SampleData ItemCount=999}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2"
|
||||||
|
CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False"
|
||||||
|
CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility ="Column">
|
||||||
|
<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="#FFF0F0F0" />
|
||||||
|
</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="溶解流程代码" Binding="{Binding DissolveCode}" Width="100" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="溶解流程名称" Binding="{Binding DissolveName}" Width="130" FontSize="15" MaxWidth="130" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="用途" Width="130" FontSize="15" MaxWidth="100" MinWidth="100" CanUserReorder="False">
|
||||||
|
<DataGridTextColumn.ElementStyle>
|
||||||
|
<Style TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="Text" Value="{Binding MaterialType, Converter={StaticResource IonSQLConvert}}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGridTextColumn.ElementStyle>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="最小量(g)" Binding="{Binding WeightMIN}" Width="130" FontSize="15" MaxWidth="130" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="最大量(g)" Binding="{Binding WeightMAX}" Width="130" FontSize="15" MaxWidth="130" MinWidth="100" CanUserReorder="False"/>
|
||||||
|
<DataGridTextColumn Header="备注" Binding="{Binding REMARK}" Width="600" FontSize="15" CanUserReorder="False"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<!--代码-->
|
||||||
|
<TextBox x:Name="Code" HorizontalAlignment="Left" Height="30" Margin="65,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="120" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,100" TextWrapping="Wrap" Text="代码"
|
||||||
|
VerticalAlignment="Bottom" Width="40" FontSize="20"/>
|
||||||
|
<!--名称-->
|
||||||
|
<TextBox x:Name="Name" HorizontalAlignment="Left" Height="30" Margin="255,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="120" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="205,0,0,100" TextWrapping="Wrap" Text="名称"
|
||||||
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
|
<!--最小-->
|
||||||
|
<TextBox x:Name="min" HorizontalAlignment="Left" Height="30" Margin="460,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="390,0,0,100" TextWrapping="Wrap" Text="最小(g)"
|
||||||
|
VerticalAlignment="Bottom" Width="80" FontSize="20"/>
|
||||||
|
<!--最大-->
|
||||||
|
<TextBox x:Name="max" HorizontalAlignment="Left" Height="30" Margin="640,0,0,100" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="22" MaxLines="1" MaxLength="25"
|
||||||
|
InputMethod.IsInputMethodEnabled="False" PreviewTextInput="Tb_KeyFloating"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="565,0,0,100" TextWrapping="Wrap" Text="最大(g)"
|
||||||
|
VerticalAlignment="Bottom" Width="80" FontSize="20"/>
|
||||||
|
<!--离子类型-->
|
||||||
|
<ComboBox x:Name="ion" HorizontalAlignment="Left" Height="30" Margin="65,0,0,50" Text=""
|
||||||
|
VerticalAlignment="Bottom" Width="120" FontSize="20" 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>
|
||||||
|
<ComboBoxItem Content="酞菁"></ComboBoxItem>
|
||||||
|
<ComboBoxItem Content="直接"></ComboBoxItem>
|
||||||
|
</ComboBox>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="15,0,0,50" TextWrapping="Wrap" Text="用途"
|
||||||
|
VerticalAlignment="Bottom" Width="50" FontSize="20"/>
|
||||||
|
<!--备注-->
|
||||||
|
<TextBox x:Name="Remark" HorizontalAlignment="Left" Height="30" Margin="255,0,0,50"
|
||||||
|
VerticalAlignment="Bottom" Width="305" FontSize="22" MaxLines="1"/>
|
||||||
|
<TextBlock HorizontalAlignment="Left" Height="30" Margin="205,0,0,50" TextWrapping="Wrap" Text="备注"
|
||||||
|
VerticalAlignment="Bottom" Width="40" FontSize="20"/>
|
||||||
|
|
||||||
|
<!--存储按钮-->
|
||||||
|
<Button Content="存储" HorizontalAlignment="Left" Height="50" Margin="795,0,0,60"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
||||||
|
Click="Button_Preservation">
|
||||||
|
</Button>
|
||||||
|
<!--删除按钮-->
|
||||||
|
<Button Content="删除" HorizontalAlignment="Left" Height="50" Margin="935,0,0,60"
|
||||||
|
VerticalAlignment="Bottom" Width="100" FontSize="30" Background="#FFEFEFEF" BorderBrush="White"
|
||||||
|
Click="Button_Delete">
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,249 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
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;
|
||||||
|
using GalaSoft.MvvmLight;
|
||||||
|
using formula_manage.SQLModels;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Data;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
||||||
|
using Xceed.Wpf.AvalonDock.Themes;
|
||||||
|
|
||||||
|
namespace formula_manage.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Machine.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class Dissolve : Window
|
||||||
|
{
|
||||||
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||||
|
|
||||||
|
string TEXT_SQLIP;
|
||||||
|
string TEXT_SQLNAME;
|
||||||
|
string TEXT_SQMOD;
|
||||||
|
string TEXT_SQLUSER;
|
||||||
|
string TEXT_SQLPASWOR;
|
||||||
|
string Connstr_SC;
|
||||||
|
public Dissolve()
|
||||||
|
{
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Dissolve_Loaded(object sender, RoutedEventArgs e)//打开页面执行
|
||||||
|
{
|
||||||
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||||
|
this.DatagridDissolve.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.DataGridEquipment_LoadingRow);//生成序列号
|
||||||
|
|
||||||
|
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||||
|
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||||
|
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||||
|
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||||
|
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||||
|
if (TEXT_SQMOD == "0") //判断连接方式
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
GridSql();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成序列号的方法
|
||||||
|
/// </summary>
|
||||||
|
private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e)
|
||||||
|
{
|
||||||
|
e.Row.Header = e.Row.GetIndex() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询数据库的方法
|
||||||
|
/// </summary>
|
||||||
|
private async void GridSql()
|
||||||
|
{
|
||||||
|
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [Dispensing].[dbo].[Dissolve]";//查询语句
|
||||||
|
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlDataAdapter Stuff_data = new SqlDataAdapter(Dissolve_sql, Connstr_SC); //查询
|
||||||
|
|
||||||
|
DataTable dataTable = new DataTable(); //建立缓存
|
||||||
|
Stuff_data.Fill(dataTable); //查询结果存入缓存
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
DatagridDissolve.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求信息失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Dissolve_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
|
||||||
|
{
|
||||||
|
int rownum = DatagridDissolve.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
/*定位选中行及指定列单元格文本信息*/
|
||||||
|
Code.Text = (DatagridDissolve.Columns[1].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//定位第列
|
||||||
|
Name.Text = (DatagridDissolve.Columns[2].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
|
||||||
|
ion.Text = (DatagridDissolve.Columns[3].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
|
||||||
|
min.Text = (DatagridDissolve.Columns[4].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
|
||||||
|
max.Text = (DatagridDissolve.Columns[5].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
|
||||||
|
Remark.Text = (DatagridDissolve.Columns[6].GetCellContent(DatagridDissolve.Items[rownum]) as TextBlock).Text.Trim();//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Tb_KeyFloating(object sender, TextCompositionEventArgs e)//输入事件
|
||||||
|
{
|
||||||
|
//Regex re = new Regex("[^0-9.-]+");
|
||||||
|
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
|
||||||
|
e.Handled = !re.IsMatch(e.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
|
||||||
|
{
|
||||||
|
Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数
|
||||||
|
Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串
|
||||||
|
string Dissolve_sql;
|
||||||
|
int int_ion = 0;
|
||||||
|
|
||||||
|
if ((Name.Text == "") ||(Code.Text == ""))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请输入代码或名称");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((min.Text == "") || (max.Text == ""))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请确认最用量");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (int.Parse(min.Text) > int.Parse(max.Text))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("用量错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ion.Text == "")
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请确认用途");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (ion.Text == "分散") int_ion = 0;
|
||||||
|
else if (ion.Text == "酸性") int_ion = 1;
|
||||||
|
else if (ion.Text == "活性") int_ion = 2;
|
||||||
|
else if (ion.Text == "中性") int_ion = 3;
|
||||||
|
else if (ion.Text == "硫化") int_ion = 4;
|
||||||
|
else if (ion.Text == "阳离子") int_ion = 5;
|
||||||
|
else if (ion.Text == "阴离子") int_ion = 6;
|
||||||
|
else if (ion.Text == "非离子") int_ion = 7;
|
||||||
|
else if (ion.Text == "酞菁") int_ion = 8;
|
||||||
|
else if (ion.Text == "直接") int_ion = 9;
|
||||||
|
|
||||||
|
if (Code.Text != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
Dissolve_sql = "SELECT count(*) FROM [Dispensing].[dbo].[Dissolve] WHERE DissolveCode = '" + Code.Text + " '";//查询语句
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
|
SqlCommand cmd = new SqlCommand(Dissolve_sql, conn_SC); //查询记录数
|
||||||
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
Dissolve_sql = string.Format("INSERT INTO[Dispensing].[dbo].[Dissolve](DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX) " +
|
||||||
|
"VALUES ('" + Code.Text + "','" + Name.Text + "','" + Remark.Text + "','" + int_ion + "','"+ min.Text + "','" + max.Text + "')");
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC);
|
||||||
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
if (sql_in == 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("添加失败");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GridSql();
|
||||||
|
System.Windows.MessageBox.Show("添加完成");//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dissolve_sql = string.Format("UPDATE [dbo].[Dissolve] SET DissolveName ='" + Name.Text + "',REMARK='" + Remark.Text + "',MaterialType='" + int_ion + "',WeightMIN='" + min.Text + "',WeightMAX='" + max.Text + "' Where DissolveCode ='" + Code.Text + "'");
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC);
|
||||||
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
|
||||||
|
if (sql_in == 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("修改失败");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GridSql();
|
||||||
|
System.Windows.MessageBox.Show("修改完成");//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
||||||
|
{
|
||||||
|
string Mac_name = "是否删除【" + this.Code.Text + "】";//获取信息并拼接提示字符串
|
||||||
|
MessageBoxResult mac_name = System.Windows.MessageBox.Show(Mac_name, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标
|
||||||
|
if (mac_name == MessageBoxResult.Yes)//判断是否删除原料
|
||||||
|
{
|
||||||
|
string Stuff_sql = string.Format("DELETE FROM [dbo].[Dissolve] WHERE Name ='" + Code.Text.ToString() + "'");
|
||||||
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
|
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
||||||
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
|
conn_SC.Close(); //关闭连接
|
||||||
|
if (sql_in == 0)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("ERR.C0110-2:删除失败", "错误");//判断执行是否成功
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GridSql();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请求失败,检查连接");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
<!--染色方式-->
|
<!--染色方式-->
|
||||||
<ComboBox x:Name="mac_Industry" HorizontalAlignment="Left" Height="30" Margin="435,0,0,100" Text=""
|
<ComboBox x:Name="mac_Industry" HorizontalAlignment="Left" Height="30" Margin="435,0,0,100" Text=""
|
||||||
VerticalAlignment="Bottom" Width="100" FontSize="16" IsReadOnly="True" IsEditable="True">
|
VerticalAlignment="Bottom" Width="100" FontSize="20" IsReadOnly="True" IsEditable="True">
|
||||||
<ComboBoxItem Content="浸染"></ComboBoxItem>
|
<ComboBoxItem Content="浸染"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="连染"></ComboBoxItem>
|
<ComboBoxItem Content="连染"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="印染"></ComboBoxItem>
|
<ComboBoxItem Content="印染"></ComboBoxItem>
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
VerticalAlignment="Bottom" Width="45" FontSize="20"/>
|
||||||
<!--类型-->
|
<!--类型-->
|
||||||
<ComboBox x:Name="mac_Categories" HorizontalAlignment="Left" Height="30" Margin="600,0,0,100" Text=""
|
<ComboBox x:Name="mac_Categories" HorizontalAlignment="Left" Height="30" Margin="600,0,0,100" Text=""
|
||||||
VerticalAlignment="Bottom" Width="100" FontSize="16" IsReadOnly="True" IsEditable="True">
|
VerticalAlignment="Bottom" Width="100" FontSize="20" IsReadOnly="True" IsEditable="True">
|
||||||
<ComboBoxItem Content="溢流"></ComboBoxItem>
|
<ComboBoxItem Content="溢流"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="气流"></ComboBoxItem>
|
<ComboBoxItem Content="气流"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="轧染"></ComboBoxItem>
|
<ComboBoxItem Content="轧染"></ComboBoxItem>
|
||||||
|
|||||||
+2
-2
@@ -115,7 +115,7 @@
|
|||||||
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
||||||
<!--原料类型-->
|
<!--原料类型-->
|
||||||
<ComboBox x:Name="stuff_ProductType" HorizontalAlignment="Left" Height="30" Margin="755,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="20" IsReadOnly="True" IsEditable="True">
|
||||||
<ComboBoxItem Content="染料"></ComboBoxItem>
|
<ComboBoxItem Content="染料"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="助剂"></ComboBoxItem>
|
<ComboBoxItem Content="助剂"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="粉体助剂"></ComboBoxItem>
|
<ComboBoxItem Content="粉体助剂"></ComboBoxItem>
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
VerticalAlignment="Bottom" Width="100" FontSize="20"/>
|
||||||
<!--离子类型-->
|
<!--离子类型-->
|
||||||
<ComboBox x:Name="Stuff_ion" HorizontalAlignment="Left" Height="30" Margin="755,0,0,50" Text=""
|
<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">
|
VerticalAlignment="Bottom" Width="100" FontSize="20" IsReadOnly="True" IsEditable="True">
|
||||||
<ComboBoxItem Content="分散"></ComboBoxItem>
|
<ComboBoxItem Content="分散"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="酸性"></ComboBoxItem>
|
<ComboBoxItem Content="酸性"></ComboBoxItem>
|
||||||
<ComboBoxItem Content="活性"></ComboBoxItem>
|
<ComboBoxItem Content="活性"></ComboBoxItem>
|
||||||
|
|||||||
@@ -188,6 +188,9 @@
|
|||||||
<Compile Include="Windows\APP_set.xaml.cs">
|
<Compile Include="Windows\APP_set.xaml.cs">
|
||||||
<DependentUpon>APP_set.xaml</DependentUpon>
|
<DependentUpon>APP_set.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Windows\Dissolve.xaml.cs">
|
||||||
|
<DependentUpon>Dissolve.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Windows\User.xaml.cs">
|
<Compile Include="Windows\User.xaml.cs">
|
||||||
<DependentUpon>User.xaml</DependentUpon>
|
<DependentUpon>User.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -238,6 +241,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Windows\Dissolve.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Windows\User.xaml">
|
<Page Include="Windows\User.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
Reference in new issue
Block a user