239 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			239 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								<UserControl x:Class="DM_Weight.Views.SelfAddWindow"
							 | 
						|||
| 
								 | 
							
								             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 
							 | 
						|||
| 
								 | 
							
								             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
							 | 
						|||
| 
								 | 
							
								             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
							 | 
						|||
| 
								 | 
							
								             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
							 | 
						|||
| 
								 | 
							
								             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
							 | 
						|||
| 
								 | 
							
								             xmlns:local="clr-namespace:DM_Weight.Views"
							 | 
						|||
| 
								 | 
							
								             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
							 | 
						|||
| 
								 | 
							
								             xmlns:convert="clr-namespace:DM_Weight.Converter"
							 | 
						|||
| 
								 | 
							
								             xmlns:prism="http://prismlibrary.com/"
							 | 
						|||
| 
								 | 
							
								             mc:Ignorable="d">
							 | 
						|||
| 
								 | 
							
								    <Grid>
							 | 
						|||
| 
								 | 
							
								        <Grid.Resources>
							 | 
						|||
| 
								 | 
							
								            <CollectionViewSource x:Key="GroupedDataList" Source="{Binding ChannelStocks}">
							 | 
						|||
| 
								 | 
							
								                <CollectionViewSource.GroupDescriptions>
							 | 
						|||
| 
								 | 
							
								                    <PropertyGroupDescription PropertyName="DrugInfo" />
							 | 
						|||
| 
								 | 
							
								                </CollectionViewSource.GroupDescriptions>
							 | 
						|||
| 
								 | 
							
								            </CollectionViewSource>
							 | 
						|||
| 
								 | 
							
								            <convert:GroupSumConverter x:Key="GroupSumConverter" />
							 | 
						|||
| 
								 | 
							
								        </Grid.Resources>
							 | 
						|||
| 
								 | 
							
								        <Grid.RowDefinitions>
							 | 
						|||
| 
								 | 
							
								            <RowDefinition Height="Auto" />
							 | 
						|||
| 
								 | 
							
								            <RowDefinition />
							 | 
						|||
| 
								 | 
							
								        </Grid.RowDefinitions>
							 | 
						|||
| 
								 | 
							
								        <Grid Margin="0 6 0 6" Grid.Row="0">
							 | 
						|||
| 
								 | 
							
								            <Grid.ColumnDefinitions>
							 | 
						|||
| 
								 | 
							
								                <ColumnDefinition Width="1.5*" />
							 | 
						|||
| 
								 | 
							
								                <ColumnDefinition Width="1.5*" />
							 | 
						|||
| 
								 | 
							
								                <ColumnDefinition Width="7*"/>
							 | 
						|||
| 
								 | 
							
								            </Grid.ColumnDefinitions>
							 | 
						|||
| 
								 | 
							
								            <ComboBox
							 | 
						|||
| 
								 | 
							
								                Grid.Column="0"
							 | 
						|||
| 
								 | 
							
								                Margin="6 0 0 0"
							 | 
						|||
| 
								 | 
							
								                Style="{StaticResource MaterialDesignOutlinedComboBox}"
							 | 
						|||
| 
								 | 
							
								                SelectedItem="{Binding SelectedItem}"
							 | 
						|||
| 
								 | 
							
								                DisplayMemberPath="Name"
							 | 
						|||
| 
								 | 
							
								                ItemsSource="{Binding Selects}"
							 | 
						|||
| 
								 | 
							
								                />
							 | 
						|||
| 
								 | 
							
								            <TextBox
							 | 
						|||
| 
								 | 
							
								                Grid.Column="1"
							 | 
						|||
| 
								 | 
							
								                Text="{Binding SearchValue}"
							 | 
						|||
| 
								 | 
							
								                materialDesign:HintAssist.Hint="{Binding SelectedItem.Name}"
							 | 
						|||
| 
								 | 
							
								                Margin="6 0 0 0"
							 | 
						|||
| 
								 | 
							
								                Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
							 | 
						|||
| 
								 | 
							
								                <Button
							 | 
						|||
| 
								 | 
							
								                Margin="0 0 3 0"
							 | 
						|||
| 
								 | 
							
								                VerticalAlignment="Center"
							 | 
						|||
| 
								 | 
							
								                Style="{StaticResource MaterialDesignOutlinedLightButton}"
							 | 
						|||
| 
								 | 
							
								                Command="{Binding OpenSelfDialog}"
							 | 
						|||
| 
								 | 
							
								                Content="加药" />
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                <Button
							 | 
						|||
| 
								 | 
							
								                Margin="0 0 6 0"
							 | 
						|||
| 
								 | 
							
								                VerticalAlignment="Center"
							 | 
						|||
| 
								 | 
							
								                Style="{StaticResource MaterialDesignOutlinedLightButton}"
							 | 
						|||
| 
								 | 
							
								                Command="{Binding QueryCommand}"
							 | 
						|||
| 
								 | 
							
								                ToolTip="刷新" Cursor="Hand">
							 | 
						|||
| 
								 | 
							
								                    <materialDesign:PackIcon
							 | 
						|||
| 
								 | 
							
								                    Kind="Refresh" />
							 | 
						|||
| 
								 | 
							
								                </Button>
							 | 
						|||
| 
								 | 
							
								            </StackPanel>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        </Grid>
							 | 
						|||
| 
								 | 
							
								        <DataGrid
							 | 
						|||
| 
								 | 
							
								                Grid.Row="1"
							 | 
						|||
| 
								 | 
							
								                materialDesign:DataGridAssist.ColumnHeaderPadding="15"
							 | 
						|||
| 
								 | 
							
								                ItemsSource="{Binding Source={StaticResource GroupedDataList}}"
							 | 
						|||
| 
								 | 
							
								                materialDesign:DataGridAssist.EnableEditBoxAssist="False"
							 | 
						|||
| 
								 | 
							
								                IsSynchronizedWithCurrentItem="True"
							 | 
						|||
| 
								 | 
							
								                materialDesign:DataGridAssist.CellPadding="13"
							 | 
						|||
| 
								 | 
							
								                CanUserAddRows="False"
							 | 
						|||
| 
								 | 
							
								                AutoGenerateColumns="False">
							 | 
						|||
| 
								 | 
							
								            <DataGrid.Resources>
							 | 
						|||
| 
								 | 
							
								                <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
							 | 
						|||
| 
								 | 
							
								                    <Setter Property="Background" Value="#31ccec" />
							 | 
						|||
| 
								 | 
							
								                    <Setter Property="Foreground" Value="white" />
							 | 
						|||
| 
								 | 
							
								                    <Setter Property="Height" Value="56" />
							 | 
						|||
| 
								 | 
							
								                    <Setter Property="BorderBrush" Value="white"/>
							 | 
						|||
| 
								 | 
							
								                    <Setter Property="BorderThickness" Value="0.6"/>
							 | 
						|||
| 
								 | 
							
								                    <Setter Property="HorizontalContentAlignment" Value="Center"/>
							 | 
						|||
| 
								 | 
							
								                </Style>
							 | 
						|||
| 
								 | 
							
								                <Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
							 | 
						|||
| 
								 | 
							
								                    <Style.Triggers>
							 | 
						|||
| 
								 | 
							
								                        <Trigger Property="IsReadOnly" Value="True">
							 | 
						|||
| 
								 | 
							
								                            <Setter Property="BorderBrush" Value="Transparent" />
							 | 
						|||
| 
								 | 
							
								                            <Setter Property="HorizontalAlignment" Value="Left"/>
							 | 
						|||
| 
								 | 
							
								                        </Trigger>
							 | 
						|||
| 
								 | 
							
								                    </Style.Triggers>
							 | 
						|||
| 
								 | 
							
								                </Style>
							 | 
						|||
| 
								 | 
							
								            </DataGrid.Resources>
							 | 
						|||
| 
								 | 
							
								            <!--GroupStyle to group data-->
							 | 
						|||
| 
								 | 
							
								            <DataGrid.GroupStyle>
							 | 
						|||
| 
								 | 
							
								                <GroupStyle>
							 | 
						|||
| 
								 | 
							
								                    <!--Group DataItems into DataGroup-->
							 | 
						|||
| 
								 | 
							
								                    <GroupStyle.ContainerStyle>
							 | 
						|||
| 
								 | 
							
								                        <Style TargetType="{x:Type GroupItem}">
							 | 
						|||
| 
								 | 
							
								                            <Setter Property="Template">
							 | 
						|||
| 
								 | 
							
								                                <Setter.Value>
							 | 
						|||
| 
								 | 
							
								                                    <ControlTemplate TargetType="{x:Type GroupItem}">
							 | 
						|||
| 
								 | 
							
								                                        <Expander IsExpanded="True"
							 | 
						|||
| 
								 | 
							
								                                                  materialDesign:ExpanderAssist.HeaderBackground="PaleTurquoise">
							 | 
						|||
| 
								 | 
							
								                                            <Expander.Header >
							 | 
						|||
| 
								 | 
							
								                                                <StackPanel Orientation="Horizontal">
							 | 
						|||
| 
								 | 
							
								                                                    <TextBlock Text="{Binding Path=Name.DrugName,StringFormat=药品:{0},}" FontWeight="Bold" />
							 | 
						|||
| 
								 | 
							
								                                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Name.DrugSpec,StringFormat=规格:{0},}" />
							 | 
						|||
| 
								 | 
							
								                                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Name.Manufactory,StringFormat=厂家:{0},}" />
							 | 
						|||
| 
								 | 
							
								                                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Name.MaxStock,StringFormat=基数:{0},}" />
							 | 
						|||
| 
								 | 
							
								                                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Items,Converter={StaticResource GroupSumConverter}}" />
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                                                </StackPanel>
							 | 
						|||
| 
								 | 
							
								                                            </Expander.Header>
							 | 
						|||
| 
								 | 
							
								                                            <ItemsPresenter/>
							 | 
						|||
| 
								 | 
							
								                                        </Expander>
							 | 
						|||
| 
								 | 
							
								                                    </ControlTemplate>
							 | 
						|||
| 
								 | 
							
								                                </Setter.Value>
							 | 
						|||
| 
								 | 
							
								                            </Setter>
							 | 
						|||
| 
								 | 
							
								                        </Style>
							 | 
						|||
| 
								 | 
							
								                    </GroupStyle.ContainerStyle>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                </GroupStyle>
							 | 
						|||
| 
								 | 
							
								            </DataGrid.GroupStyle>
							 | 
						|||
| 
								 | 
							
								            <DataGrid.Columns>
							 | 
						|||
| 
								 | 
							
								                <DataGridTextColumn Width="210"
							 | 
						|||
| 
								 | 
							
								                        Binding="{Binding Location}"
							 | 
						|||
| 
								 | 
							
								                        Header="库位"
							 | 
						|||
| 
								 | 
							
								                        IsReadOnly="True"
							 | 
						|||
| 
								 | 
							
								                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
							 | 
						|||
| 
								 | 
							
								                <DataGridTextColumn Width="210"
							 | 
						|||
| 
								 | 
							
								                        Binding="{Binding ManuNo}"
							 | 
						|||
| 
								 | 
							
								                        Header="批次"
							 | 
						|||
| 
								 | 
							
								                        IsReadOnly="True"
							 | 
						|||
| 
								 | 
							
								                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
							 | 
						|||
| 
								 | 
							
								                <DataGridTextColumn Width="210"
							 | 
						|||
| 
								 | 
							
								                        Binding="{Binding EffDate}"
							 | 
						|||
| 
								 | 
							
								                        Header="效期"
							 | 
						|||
| 
								 | 
							
								                        IsReadOnly="True"
							 | 
						|||
| 
								 | 
							
								                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
							 | 
						|||
| 
								 | 
							
								                <DataGridTextColumn Width="210"
							 | 
						|||
| 
								 | 
							
								                        Binding="{Binding Quantity}"
							 | 
						|||
| 
								 | 
							
								                        Header="库存"
							 | 
						|||
| 
								 | 
							
								                        IsReadOnly="True"
							 | 
						|||
| 
								 | 
							
								                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
							 | 
						|||
| 
								 | 
							
								                <!--<DataGridTextColumn
							 | 
						|||
| 
								 | 
							
								                        Binding="{Binding AddQuantity, ValidatesOnExceptions=True}"
							 | 
						|||
| 
								 | 
							
								                        Header="添加数量"
							 | 
						|||
| 
								 | 
							
								                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>-->
							 | 
						|||
| 
								 | 
							
								                <DataGridTemplateColumn Width="151"
							 | 
						|||
| 
								 | 
							
								                        Header="添加数量">
							 | 
						|||
| 
								 | 
							
								                    <DataGridTemplateColumn.CellTemplate>
							 | 
						|||
| 
								 | 
							
								                        <DataTemplate>
							 | 
						|||
| 
								 | 
							
								                            <TextBox Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}">
							 | 
						|||
| 
								 | 
							
								                                <TextBox.Text>
							 | 
						|||
| 
								 | 
							
								                                    <Binding Path="AddQuantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
							 | 
						|||
| 
								 | 
							
								                                        <Binding.ValidationRules>
							 | 
						|||
| 
								 | 
							
								                                            <ExceptionValidationRule />
							 | 
						|||
| 
								 | 
							
								                                        </Binding.ValidationRules>
							 | 
						|||
| 
								 | 
							
								                                    </Binding>
							 | 
						|||
| 
								 | 
							
								                                </TextBox.Text>
							 | 
						|||
| 
								 | 
							
								                            </TextBox>
							 | 
						|||
| 
								 | 
							
								                        </DataTemplate>
							 | 
						|||
| 
								 | 
							
								                    </DataGridTemplateColumn.CellTemplate>
							 | 
						|||
| 
								 | 
							
								                </DataGridTemplateColumn>
							 | 
						|||
| 
								 | 
							
								            </DataGrid.Columns>
							 | 
						|||
| 
								 | 
							
								        </DataGrid>
							 | 
						|||
| 
								 | 
							
								        <!--<Grid Grid.Row="1">
							 | 
						|||
| 
								 | 
							
								            <Grid.ColumnDefinitions>
							 | 
						|||
| 
								 | 
							
								                <ColumnDefinition Width="Auto" />
							 | 
						|||
| 
								 | 
							
								                <ColumnDefinition />
							 | 
						|||
| 
								 | 
							
								            </Grid.ColumnDefinitions>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            <ListView Grid.Column="0" ItemsSource="{Binding DrugInfos}" 
							 | 
						|||
| 
								 | 
							
								                  SelectedItem="{Binding SelectedDrug}" materialDesign:ListViewAssist.HeaderRowBackground="#31ccec" materialDesign:ListViewAssist.ListViewItemPadding="12">
							 | 
						|||
| 
								 | 
							
								                <i:Interaction.Triggers>
							 | 
						|||
| 
								 | 
							
								                    <i:EventTrigger EventName="SelectionChanged">
							 | 
						|||
| 
								 | 
							
								                        <i:InvokeCommandAction Command="{Binding RowSelected}" />
							 | 
						|||
| 
								 | 
							
								                    </i:EventTrigger>
							 | 
						|||
| 
								 | 
							
								                </i:Interaction.Triggers>
							 | 
						|||
| 
								 | 
							
								                <ListView.Resources>
							 | 
						|||
| 
								 | 
							
								                    <Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
							 | 
						|||
| 
								 | 
							
								                        <Setter Property="Foreground" Value="White" />
							 | 
						|||
| 
								 | 
							
								                    </Style>
							 | 
						|||
| 
								 | 
							
								                </ListView.Resources>
							 | 
						|||
| 
								 | 
							
								                <ListView.View>
							 | 
						|||
| 
								 | 
							
								                    <GridView>
							 | 
						|||
| 
								 | 
							
								                        <GridViewColumn
							 | 
						|||
| 
								 | 
							
								                        Header="药品名称"
							 | 
						|||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding DrugName}"/>
							 | 
						|||
| 
								 | 
							
								                        <GridViewColumn
							 | 
						|||
| 
								 | 
							
								                        Header="规格"
							 | 
						|||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding DrugSpec}" />
							 | 
						|||
| 
								 | 
							
								                        <GridViewColumn
							 | 
						|||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding StockQuantity}"
							 | 
						|||
| 
								 | 
							
								                        Header="库存"/>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    </GridView>
							 | 
						|||
| 
								 | 
							
								                </ListView.View>
							 | 
						|||
| 
								 | 
							
								            </ListView>
							 | 
						|||
| 
								 | 
							
								            <ListView Grid.Column="1" Margin="6 0 0 0" ItemsSource="{Binding ChannelStocks}" 
							 | 
						|||
| 
								 | 
							
								                      materialDesign:ListViewAssist.HeaderRowBackground="#31ccec" materialDesign:ListViewAssist.ListViewItemPadding="12">
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                <ListView.Resources>
							 | 
						|||
| 
								 | 
							
								                    <Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
							 | 
						|||
| 
								 | 
							
								                        <Setter Property="Foreground" Value="White" />
							 | 
						|||
| 
								 | 
							
								                    </Style>
							 | 
						|||
| 
								 | 
							
								                </ListView.Resources>
							 | 
						|||
| 
								 | 
							
								                <ListView.View>
							 | 
						|||
| 
								 | 
							
								                    <GridView>
							 | 
						|||
| 
								 | 
							
								                        <GridViewColumn
							 | 
						|||
| 
								 | 
							
								                        Header="选择"
							 | 
						|||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding IsSelected}"/>
							 | 
						|||
| 
								 | 
							
								                        <GridViewColumn
							 | 
						|||
| 
								 | 
							
								                        Header="库位"
							 | 
						|||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding Location}" />
							 | 
						|||
| 
								 | 
							
								                        <GridViewColumn
							 | 
						|||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding ManuNo}"
							 | 
						|||
| 
								 | 
							
								                        Header="批次"/>
							 | 
						|||
| 
								 | 
							
								                        <GridViewColumn
							 | 
						|||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding EffDate}"
							 | 
						|||
| 
								 | 
							
								                        Header="效期"/>
							 | 
						|||
| 
								 | 
							
								                        <GridViewColumn
							 | 
						|||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding Quantity}"
							 | 
						|||
| 
								 | 
							
								                        Header="库存"/>
							 | 
						|||
| 
								 | 
							
								                        <GridViewColumn
							 | 
						|||
| 
								 | 
							
								                        DisplayMemberBinding="{Binding AddQuantity}"
							 | 
						|||
| 
								 | 
							
								                        Header="添加数量"/>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    </GridView>
							 | 
						|||
| 
								 | 
							
								                </ListView.View>
							 | 
						|||
| 
								 | 
							
								            </ListView>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        </Grid>-->
							 | 
						|||
| 
								 | 
							
								        
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    </Grid>
							 | 
						|||
| 
								 | 
							
								</UserControl>
							 |