You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

217 lines
21 KiB

<Window x:Class="formula_manage.MainWindow"
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"
xmlns:ViewModel="clr-namespace:formula_manage.ViewModel"
mc:Ignorable="d" Loaded="Window_MIN"
Title="SUNLIGHT" Height="720" Width="1280" MinHeight="720" MinWidth="1280"
DataContext="{Binding Source={StaticResource Locator}, Path=Main}"
BorderBrush="White" Background="#FFE0E0E0">
<Window.Resources>
<ViewModel:MainWindowViewModel x:Key="MainWindowViewModel"/>
</Window.Resources>
<Grid>
<Menu IsTabStop="False" Grid.ColumnSpan="2">
<MenuItem x:Name="tab" Header="_文件" FontSize="16" Focusable ="False" >
<MenuItem Header="_许可证" FontSize="16"/>
<Separator/>
<MenuItem Header="_注销" FontSize="16" Click="logout"/>
</MenuItem>
<MenuItem Header="_设置" FontSize="16" Focusable ="False" >
<MenuItem Header="_数据库设置" FontSize="16" Name="_SQL" Click="SQL" IsEnabled="False"/>
<MenuItem Header="_备份/还原" FontSize="16" Name="_SQLBAK" Click="SQLBAK" IsEnabled="False"/>
<Separator/>
<MenuItem Header="_软件设置" FontSize="16" Name="_SOFTWARE_SET" Click="SOFTWARE_SET" IsEnabled="False"/>
<MenuItem Header="_打印设置" FontSize="16" Name="_PRINT_SET" Click="PRINT_SET" IsEnabled="False"/>
<MenuItem Header="_用户设置" FontSize="16" Name="_USER_SET" Click="USER_SET" IsEnabled="False"/>
</MenuItem>
<MenuItem Header="_管理" FontSize="16" Focusable ="False">
<MenuItem Header="_染色机管理" FontSize="16" Name="_MAC_SET" Click="MAC_SET" IsEnabled="False"/>
<MenuItem Header="_原料信息管理" FontSize="16" Name="_STUFF" Click="STUFF" IsEnabled="False"/>
<Separator/>
<MenuItem Header="_预设配方管理" FontSize="16" Name="_RECIPE" Click="RECIPE" IsEnabled="False"/>
<MenuItem Header="_预设工艺管理" FontSize="16" Name="_PROCESS" Click="PROCESS" IsEnabled="False"/>
<Separator/>
<MenuItem Header="_配送流程管理" FontSize="16" Name="_WORKFLOW" Click="WORKFLOW" IsEnabled="False"/>
<Separator />
<MenuItem Header="_布种" FontSize="16" Name="_fabric" Click="fabric" IsEnabled="False"/>
<MenuItem Header="_品名" FontSize="16" Name="_variety" Click="variety" IsEnabled="False"/>
<MenuItem Header="_色号" FontSize="16" Name="_color" Click="color" IsEnabled="False"/>
<MenuItem Header="_客户" FontSize="16" Name="_client" Click="client" IsEnabled="False"/>
</MenuItem>
<MenuItem Header="_查询" FontSize="16" Focusable ="False">
<MenuItem Header="_领料单据" FontSize="16"/>
<MenuItem Header="_转换历史" FontSize="16"/>
<MenuItem Header="_统计" FontSize="16" Name="_statistics" IsEnabled="False"/>
</MenuItem>
<MenuItem Header="_帮助" FontSize="16" Focusable ="False">
<MenuItem Header="_帮助" FontSize="16" Click="HELP"/>
</MenuItem>
</Menu>
<TextBox x:Name="USERTIME" Text="{Binding Sys_Time}" HorizontalAlignment="Right" Height="30" Margin="0,0,5,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="14"
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False" Grid.Column="1"/>
<TextBox x:Name="USER" HorizontalAlignment="Right" Height="30" Margin="0,0,155,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="100" FontSize="14"
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False" Grid.Column="1"/>
<Button Content="新工单" HorizontalAlignment="Left" Margin="335,35,0,0" Height="30" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" FontSize="20" Click="Button_NewOrder" Focusable ="False" Grid.Column="1"/>
<Button Content="归属订单" HorizontalAlignment="Left" Margin="300,70,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Order" Grid.Column="1"/>
<Button Content="预设工艺" HorizontalAlignment="Left" Margin="300,105,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology" Grid.Column="1"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,35,0,0" TextWrapping="Wrap" Text="领料单号:" VerticalAlignment="Top" Width="90" FontSize="20" Background="WhiteSmoke"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,70,0,0" TextWrapping="Wrap" Text="流转订单:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,105,0,0" TextWrapping="Wrap" Text="执行工艺:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,140,0,0" TextWrapping="Wrap" Text="机台:" VerticalAlignment="Top" Width="80" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="5,175,0,0" TextWrapping="Wrap" Text="类型:" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="230,140,0,0" TextWrapping="Wrap" Text="总步数:" VerticalAlignment="Top" Width="70" FontSize="20" Grid.ColumnSpan="2"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="230,175,0,0" TextWrapping="Wrap" Text="表单:" VerticalAlignment="Top" Width="70" FontSize="20" Grid.ColumnSpan="2"/>
<ComboBox x:Name="Forms_" HorizontalAlignment="Left" Height="30" Margin="300,175,0,0" VerticalAlignment="Top" Width="105" FontSize="20" IsTabStop="True" Grid.Column="1"/>
<TextBox x:Name="Number" HorizontalAlignment="Left" ToolTip="当前配方的物料单" Height="30" Margin="95,35,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" Grid.ColumnSpan="2"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,70,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
<TextBox x:Name="ReDye" HorizontalAlignment="Left" Height="30" Margin="300,35,0,0" TextWrapping="Wrap" Text="0" VerticalAlignment="Top" Width="30" FontSize="20"
MaxLines="1" MaxLength="2" Grid.Column="1" IsReadOnly="True"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="95,105,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" FontSize="20" KeyUp="SearchBox_OnKeyDownd" IsTabStop="False" Grid.ColumnSpan="2"/>
<ComboBox x:Name="Machine" DisplayMemberPath="Name"
ItemsSource="{Binding mac_Machine, Source={StaticResource MainWindowViewModel}}"
HorizontalAlignment="Left" Height="30" Margin="95,140,0,0" VerticalAlignment="Top" Width="120" FontSize="20"
KeyUp="Machine_OnKeyDownd" DropDownClosed="Machine_DropDownClosed" InputMethod.IsInputMethodEnabled="False"/>
<ComboBox x:Name="OrderType" Text="正常单"
HorizontalAlignment="Left" Height="30" Margin="95,175,0,0" VerticalAlignment="Top" Width="120" FontSize="20"
IsTabStop="True" KeyUp="SearchBox_OnKeyDownd" IsEditable="True" IsReadOnly="True">
<ComboBoxItem Content="正常单"></ComboBoxItem>
<ComboBoxItem Content="追加单"></ComboBoxItem>
</ComboBox>
<TextBox x:Name="Procedures_N" HorizontalAlignment="Left" Height="30" Margin="300,140,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="85" FontSize="20"
KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" Grid.Column="1"/>
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="385,140,0,0" VerticalAlignment="Top" FontSize="10"
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_up" IsTabStop="False" Focusable ="False" Grid.Column="1"/>
<Button Content="-" HorizontalAlignment="Left" Height="15" Width="20" Margin="385,155,0,0" VerticalAlignment="Top" FontSize="10"
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" Click="Button_dow" IsTabStop="False" Focusable ="False" Grid.Column="1"/>
<Grid Height="150" Width="405" Margin="5,210,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Background="#FFF7F7F7" Grid.ColumnSpan="2">
<Button Content="..." HorizontalAlignment="Left" Margin="370,40,0,0" Height="30" VerticalAlignment="Top" Width="30" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Formula" Grid.Column="1"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,5,0,0" TextWrapping="Wrap" Text="步序:" VerticalAlignment="Top" Width="70" FontSize="20"/>
<TextBox x:Name="Procedures_P" HorizontalAlignment="Left" Height="30" Margin="90,5,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="50" FontSize="20"
KeyUp="SearchBox_OnKeyDownd" MaxLines="1" MaxLength="3" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False"/>
<Button Content="+" HorizontalAlignment="Left" Height="15" Width="20" Margin="140,5,0,0" VerticalAlignment="Top" FontSize="10"
Background="#FFF1F1F1" BorderBrush="#FFC5C5C5" Padding="0,0,0,0" IsTabStop="False" Click="Button_StepUp" Focusable ="False"/>
<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"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="170,5,0,0" TextWrapping="Wrap" Text="流程:" VerticalAlignment="Top" Width="45" FontSize="20"/>
<ComboBox Name="Workflow" DisplayMemberPath="DissolveName" ItemsSource="{Binding flow_Workflow, Source={StaticResource MainWindowViewModel}}" StaysOpenOnEdit="True"
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"/>
<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"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,75,0,0" TextWrapping="Wrap" Text="重量(KG):" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBox x:Name="list_Weight" HorizontalAlignment="Left" Height="30" Margin="90,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20"
KeyUp="SearchBox_OnKeyDownd" TextChanged="Weight" PreviewTextInput="Tb_KeyFloating" InputMethod.IsInputMethodEnabled="False"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,75,0,0" TextWrapping="Wrap" Text="浴比:" VerticalAlignment="Top" Width="90" FontSize="20" Grid.ColumnSpan="2"/>
<TextBox x:Name="list_Proportion" HorizontalAlignment="Left" Height="30" Margin="270,75,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="130" FontSize="20"
KeyUp="SearchBox_OnKeyDownd" TextChanged="Proportion" PreviewTextInput="Tb_KeyFloating" InputMethod.IsInputMethodEnabled="False" Grid.Column="1"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="0,110,0,0" TextWrapping="Wrap" Text="浴量(L):" VerticalAlignment="Top" Width="90" FontSize="20"/>
<TextBox x:Name="list_Total" HorizontalAlignment="Left" Height="30" Margin="90,110,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="125" FontSize="20" />
<TextBlock HorizontalAlignment="Left" Height="35" Margin="220,110,0,0" TextWrapping="Wrap" Text="修正:" VerticalAlignment="Top" Width="90" FontSize="20" Grid.ColumnSpan="2"/>
<TextBox HorizontalAlignment="Left" Height="30" Margin="270,110,0,0" Text="" VerticalAlignment="Top" Width="130" FontSize="20" Focusable ="False" Grid.Column="1"/>
</Grid>
<DataGrid x:Name="Grid_RRODUCT" AlternationCount="2" IsReadOnly="False" InitializingNewItem="DataGrid_InitializingNewItem"
Margin="5,365,5,80" d:ItemsSource="{d:SampleData ItemCount=99}" 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" CanUserSortColumns="False" CanUserResizeRows="False"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column"
Background="White" SelectionMode="Single" FontSize="15" >
<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="#FFFFFFFF" />
</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="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#000000"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Resources>
<Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#000000"/>
<Setter Property="DataContext" Value="{Binding Source={StaticResource Locator}, Path=Main}"/>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<!--列信息绑定-->
<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}"/>
<DataGridTemplateColumn Header="原料代码" Width="200" MaxWidth="400" MinWidth="100" IsReadOnly="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="CP_PRODUCT_CODE" BorderThickness="0,0,0,0"
ItemsSource="{Binding stuff_Product, Source={StaticResource MainWindowViewModel}}"
DisplayMemberPath="ProductCode"
Text="{Binding PRODUCT_CODE}" IsTextSearchEnabled="True" StaysOpenOnEdit="True"
BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True"
KeyDown="CP_PRODUCT_CODE_KeyUp"
DropDownClosed="CP_PRODUCT_CODE_DropDownClosed">
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="目标饱和度(%)" Width="200" MaxWidth="400" MinWidth="100" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox x:Name="CP_CONC" BorderThickness="0,0,0,0" Text="{Binding CONC}"
BorderBrush="{x:Null}" Background="{x:Null}"
KeyDown="CP_CONC_KeyUp"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="计算单位" Width="80" MaxWidth="80" MinWidth="80" CellStyle="{StaticResource CellStyle}" Binding="{Binding SHIFT}"/>
<DataGridTemplateColumn Header="原料名称" Width="200" MaxWidth="400" MinWidth="100" CellStyle="{StaticResource CellStyle}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="CP_PRODUCT_NAME" BorderThickness="0,0,0,0"
ItemsSource="{Binding stuff_Product, Source={StaticResource MainWindowViewModel}}"
DisplayMemberPath="ProductName"
Text="{Binding PRODUCT_NAME}"
DropDownClosed="CP_PRODUCT_NAME_DropDownClosed"
BorderBrush="{x:Null}" Background="{x:Null}" IsEditable="True" IsReadOnly="True" Focusable="True" IsTabStop="False"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="目标重量(g)" Width="200" FontSize="15" MaxWidth="400" MinWidth="100" IsReadOnly="True" Binding="{Binding TARGET_WT}" CellStyle="{StaticResource CellStyle}"/>
<DataGridTextColumn Header="单位" Width="80" FontSize="15" MaxWidth="80" MinWidth="80" IsReadOnly="True" Binding="{Binding UNIT}" CellStyle="{StaticResource CellStyle}"/>
<DataGridTextColumn Header="备注" Width="600" FontSize="15" MinWidth="600" Binding="{Binding REMARK}" CellStyle="{StaticResource CellStyle}" IsReadOnly="False"/>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="Confirm" Content="确认" IsEnabled="False" HorizontalAlignment="Right" Height="40" Width="80" Margin="0,0,140,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="confirm" Grid.Column="1"/>
<Button x:Name="Print" Content="打印" HorizontalAlignment="Right" Height="40" Width="80" Margin="0,0,55,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="print" IsTabStop="False" Focusable ="False" Grid.Column="1"/>
<Button x:Name="Save" Content="保存" IsEnabled="False" HorizontalAlignment="Left" Height="40" Width="80" Margin="15,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="save" IsTabStop="False" Focusable ="False"/>
<Button x:Name="Delete" Content="删除" IsEnabled="False" HorizontalAlignment="Left" Height="40" Width="80" Margin="100,0,0,20" VerticalAlignment="Bottom" FontSize="20" Background="#FFEFEFEF" BorderBrush="White" Click="delete" IsTabStop="False" Focusable ="False"/>
<Grid Grid.Column="1" Height="325" Margin="415,35,5,0" VerticalAlignment="Top" Background="#FFF7F7F7">
<ContentControl x:Name="Deputy"/>
</Grid>
</Grid>
</Window>