新增原料入场记录独立页面,更新导航和菜单配置以支持新功能。优化原料入场记录编辑对话框,增强物料选择和显示逻辑,提升用户体验。

This commit is contained in:
geht
2026-05-09 18:25:34 +08:00
parent 068d44c53e
commit 0e89648e8a
16 changed files with 1624 additions and 51 deletions

View File

@@ -31,30 +31,46 @@
<StackPanel x:Name="RootPanel" Margin="24,8,24,8">
<hc:Row Gutter="16">
<!-- 密炼物料选择(搜索下拉 -->
<!-- 密炼物料选择(弹窗 -->
<hc:Col Span="16">
<DockPanel Margin="0,0,0,8" LastChildFill="True">
<TextBlock DockPanel.Dock="Left" Text="密炼物料" Width="80"
VerticalAlignment="Center"
Foreground="{DynamicResource PrimaryTextBrush}"/>
<hc:ComboBox ItemsSource="{Binding MaterialOptions}"
SelectedItem="{Binding SelectedMaterial}"
IsEditable="True"
IsTextSearchEnabled="True"
TextSearch.TextPath="MaterialCode"
Height="34"
hc:InfoElement.Placeholder="输入物料编码搜索">
<hc:ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock>
<Run Text="{Binding MaterialCode, Mode=OneWay}"/>
<Run Text=" — "/>
<Run Text="{Binding MaterialName, Mode=OneWay}"/>
</TextBlock>
</DataTemplate>
</hc:ComboBox.ItemTemplate>
</hc:ComboBox>
</DockPanel>
<Grid Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="密炼物料" VerticalAlignment="Center"
FontSize="14" Foreground="{DynamicResource PrimaryTextBrush}"/>
<Border Grid.Column="1" CornerRadius="4" Height="34"
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
Background="{DynamicResource ThirdlyRegionBrush}">
<TextBlock Text="{Binding SelectedMaterialDisplay}" VerticalAlignment="Center"
Margin="8,0" FontSize="13" TextTrimming="CharacterEllipsis">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasSelectedMaterial}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
<Button Grid.Column="2" Content="选 择"
Command="{Binding OpenMaterialPickerCommand}"
Style="{StaticResource ButtonPrimary}"
Height="34" Margin="6,0,0,0" FontSize="12"/>
<Button Grid.Column="3"
Command="{Binding ClearMaterialCommand}"
Style="{StaticResource ButtonIcon}"
Height="34" Width="28" Margin="4,0,0,0" Padding="0"
ToolTip="清除物料"
Foreground="{DynamicResource SecondaryTextBrush}"
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"/>
</Grid>
</hc:Col>
<!-- 物料名称(只读回显) -->
@@ -106,16 +122,36 @@
</DockPanel>
</hc:Col>
<!-- 榜单号 -->
<!-- 榜单号(弹窗选择) -->
<hc:Col Span="8">
<hc:TextBox Text="{Binding Entry.BillNo, UpdateSourceTrigger=PropertyChanged}"
Height="34"
hc:InfoElement.Title="榜单号"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入榜单号"
hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/>
<Grid Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="榜单号" VerticalAlignment="Center"
FontSize="14" Foreground="{DynamicResource PrimaryTextBrush}"/>
<Border Grid.Column="1" CornerRadius="4" Height="34"
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
Background="{DynamicResource ThirdlyRegionBrush}">
<TextBlock Text="{Binding Entry.BillNo}" VerticalAlignment="Center"
Margin="8,0" FontSize="13" TextTrimming="CharacterEllipsis"
Foreground="{DynamicResource PrimaryTextBrush}"/>
</Border>
<Button Grid.Column="2" Content="选 择"
Command="{Binding OpenWeightRecordPickerCommand}"
Style="{StaticResource ButtonPrimary}"
Height="34" Margin="6,0,0,0" FontSize="12"/>
<Button Grid.Column="3"
Command="{Binding ClearWeightRecordCommand}"
Style="{StaticResource ButtonIcon}"
Height="34" Width="28" Margin="4,0,0,0" Padding="0"
ToolTip="清除榜单"
Foreground="{DynamicResource SecondaryTextBrush}"
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"/>
</Grid>
</hc:Col>
<!-- 供料客户 -->
@@ -137,8 +173,9 @@
hc:InfoElement.Title="供应商名称"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入供应商名称"
hc:InfoElement.Placeholder="根据榜单自动带出"
hc:InfoElement.ShowClearButton="True"
IsReadOnly="True"
Margin="0,0,0,8"/>
</hc:Col>
@@ -151,6 +188,7 @@
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入厂家物料名称"
hc:InfoElement.ShowClearButton="True"
IsReadOnly="True"
Margin="0,0,0,8"/>
</hc:Col>
@@ -161,14 +199,15 @@
hc:InfoElement.Title="保质期"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入保质期"
hc:InfoElement.Placeholder="自动计算到期日期"
hc:InfoElement.ShowClearButton="True"
IsReadOnly="True"
Margin="0,0,0,8"/>
</hc:Col>
<!-- 总重(KG) -->
<hc:Col Span="8">
<hc:NumericUpDown Value="{Binding Entry.TotalWeight}"
<hc:NumericUpDown Value="{Binding TotalWeightInput}"
Minimum="0"
DecimalPlaces="2"
Height="34"
@@ -182,7 +221,7 @@
<!-- 总份数 -->
<hc:Col Span="8">
<hc:NumericUpDown Value="{Binding Entry.TotalPortions}"
<hc:NumericUpDown Value="{Binding TotalPortionsInput}"
Minimum="0"
DecimalPlaces="0"
Height="34"
@@ -204,7 +243,8 @@
hc:InfoElement.Title="每份总重(KG)"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入每份总重"
hc:InfoElement.Placeholder="自动按总重/总份数计算"
IsReadOnly="True"
Margin="0,0,0,8"/>
</hc:Col>

View File

@@ -0,0 +1,172 @@
<UserControl x:Class="YY.Admin.Views.RawMaterialEntry.RawMaterialEntryMaterialPickerDialogView"
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:hc="https://handyorg.github.io/handycontrol"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d"
Width="760">
<Grid Background="{DynamicResource ThirdlyRegionBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="360"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<hc:SimplePanel Margin="20,16,20,12">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Border Width="32" Height="32" CornerRadius="6" Background="{DynamicResource PrimaryBrush}" Margin="0,0,10,0">
<md:PackIcon Kind="FlaskOutline" Width="18" Height="18" Foreground="White"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<TextBlock Text="选择密炼物料" FontSize="16" FontWeight="SemiBold"
Foreground="{DynamicResource PrimaryTextBrush}" VerticalAlignment="Center"/>
</StackPanel>
<Button Width="22" Height="22" Command="hc:ControlCommands.Close"
Style="{StaticResource ButtonIcon}"
Foreground="{DynamicResource PrimaryBrush}"
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"
Padding="0" HorizontalAlignment="Right" VerticalAlignment="Center"/>
</hc:SimplePanel>
<Border Grid.Row="1" Background="{DynamicResource RegionBrush}" Padding="16,10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<hc:TextBox Text="{Binding SearchCode, UpdateSourceTrigger=PropertyChanged}"
hc:InfoElement.Placeholder="输入物料编码搜索..."
hc:InfoElement.ShowClearButton="True"
Margin="0,0,8,0">
<hc:TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding SearchCommand}"/>
</hc:TextBox.InputBindings>
</hc:TextBox>
<hc:TextBox Grid.Column="1"
Text="{Binding SearchName, UpdateSourceTrigger=PropertyChanged}"
hc:InfoElement.Placeholder="输入物料名称搜索..."
hc:InfoElement.ShowClearButton="True"
Margin="0,0,8,0">
<hc:TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding SearchCommand}"/>
</hc:TextBox.InputBindings>
</hc:TextBox>
<Button Grid.Column="2" Command="{Binding SearchCommand}"
IsEnabled="{Binding IsLoading, Converter={StaticResource Boolean2BooleanReConverter}}"
Style="{StaticResource ButtonPrimary}" Height="32">
<StackPanel Orientation="Horizontal">
<md:PackIcon Kind="Magnify" Width="14" Height="14" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBlock Text="搜索" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Button>
</Grid>
</Border>
<DataGrid x:Name="MaterialsGrid"
Grid.Row="2"
Margin="16,8,16,0"
ItemsSource="{Binding Materials}"
SelectedItem="{Binding SelectedMaterial}"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserResizeRows="False"
HeadersVisibility="Column"
SelectionMode="Single"
SelectionUnit="FullRow"
IsReadOnly="True"
GridLinesVisibility="Horizontal"
HorizontalGridLinesBrush="#FFEDEFF2"
VerticalGridLinesBrush="Transparent"
Background="White"
RowBackground="White"
AlternatingRowBackground="#FAFCFF"
RowHeight="32"
ColumnHeaderHeight="34"
RowHeaderWidth="0"
MouseDoubleClick="MaterialsGrid_MouseDoubleClick">
<DataGrid.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#EAF3FF"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#1F1F1F"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#EAF3FF"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#1F1F1F"/>
</DataGrid.Resources>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#F5F7FA"/>
<Setter Property="Foreground" Value="#606266"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="8,0"/>
<Setter Property="BorderBrush" Value="#EBEEF5"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="#262626"/>
<Setter Property="BorderBrush" Value="#FFEDEFF2"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#EAF3FF"/>
<Setter Property="Foreground" Value="#1F1F1F"/>
<Setter Property="BorderBrush" Value="#D6E8FF"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#F5F9FF"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="8,0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="物料编码" Binding="{Binding MaterialCode}" Width="180"/>
<DataGridTextColumn Header="物料名称" Binding="{Binding MaterialName}" Width="*"/>
<DataGridTextColumn Header="厂家别名" Binding="{Binding AliasName}" Width="150"/>
<DataGridTextColumn Header="保质期(天)" Binding="{Binding ShelfLifeDays}" Width="100"/>
</DataGrid.Columns>
</DataGrid>
<Border Grid.Row="3" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0"
Padding="16,12">
<Grid>
<TextBlock VerticalAlignment="Center" FontSize="13" MaxWidth="420"
TextTrimming="CharacterEllipsis" HorizontalAlignment="Left"
Text="{Binding SelectedMaterialDisplay}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasSelectedMaterial}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="取 消" Command="{Binding CancelCommand}"
Style="{StaticResource ButtonDefault}" Width="88" Margin="0,0,12,0" Height="34"/>
<Button Content="确认选择" Command="{Binding ConfirmCommand}"
Style="{StaticResource ButtonPrimary}" Width="100" Height="34"/>
</StackPanel>
</Grid>
</Border>
</Grid>
</UserControl>

View File

@@ -0,0 +1,21 @@
using System.Windows.Controls;
using System.Windows.Input;
using YY.Admin.ViewModels.RawMaterialEntry;
namespace YY.Admin.Views.RawMaterialEntry;
public partial class RawMaterialEntryMaterialPickerDialogView : UserControl
{
public RawMaterialEntryMaterialPickerDialogView()
{
InitializeComponent();
}
private void MaterialsGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (DataContext is RawMaterialEntryMaterialPickerDialogViewModel vm && vm.ConfirmCommand.CanExecute())
{
vm.ConfirmCommand.Execute();
}
}
}

View File

@@ -0,0 +1,507 @@
<UserControl x:Class="YY.Admin.Views.RawMaterialEntry.RawMaterialEntryOperationView"
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:hc="https://handyorg.github.io/handycontrol"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d">
<Grid Style="{StaticResource BaseViewStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<hc:SimplePanel Margin="24,16,24,12">
<TextBlock FontSize="18"
Foreground="{DynamicResource PrimaryTextBrush}"
Text="新增原料入场记录"
HorizontalAlignment="Left"
VerticalAlignment="Center"/>
</hc:SimplePanel>
<hc:ScrollViewer Grid.Row="1" IsInertiaEnabled="True" HorizontalScrollBarVisibility="Disabled">
<StackPanel x:Name="RootPanel" Margin="24,8,24,8">
<hc:Row Gutter="16">
<hc:Col Span="16">
<Grid Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="密炼物料" VerticalAlignment="Center"
FontSize="14" Foreground="{DynamicResource PrimaryTextBrush}"/>
<Border Grid.Column="1" CornerRadius="4" Height="34"
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
Background="{DynamicResource ThirdlyRegionBrush}">
<TextBlock Text="{Binding SelectedMaterialDisplay}" VerticalAlignment="Center"
Margin="8,0" FontSize="13" TextTrimming="CharacterEllipsis">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasSelectedMaterial}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
<Button Grid.Column="2" Content="选 择"
Command="{Binding OpenMaterialPickerCommand}"
Style="{StaticResource ButtonPrimary}"
Height="34" Margin="6,0,0,0" FontSize="12"/>
<Button Grid.Column="3"
Command="{Binding ClearMaterialCommand}"
Style="{StaticResource ButtonIcon}"
Height="34" Width="28" Margin="4,0,0,0" Padding="0"
ToolTip="清除物料"
Foreground="{DynamicResource SecondaryTextBrush}"
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"/>
</Grid>
</hc:Col>
<hc:Col Span="8">
<hc:TextBox Text="{Binding Entry.MaterialName}"
Height="34"
IsReadOnly="True"
hc:InfoElement.Title="物料名称"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
Foreground="{DynamicResource SecondaryTextBrush}"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:TextBox Text="{Binding Entry.Barcode, UpdateSourceTrigger=PropertyChanged}"
Height="34"
IsReadOnly="True"
hc:InfoElement.Title="条码"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="自动生成"
hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:TextBox Text="{Binding Entry.BatchNo, UpdateSourceTrigger=PropertyChanged}"
Height="34"
IsReadOnly="True"
hc:InfoElement.Title="批次号"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="自动生成"
hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<DockPanel Margin="0,0,0,8" LastChildFill="True">
<TextBlock DockPanel.Dock="Left" Text="入场时间" Width="80"
VerticalAlignment="Center"
Foreground="{DynamicResource PrimaryTextBrush}"/>
<hc:DateTimePicker SelectedDateTime="{Binding Entry.EntryTime}"
hc:InfoElement.Placeholder="请选择入场时间"
hc:InfoElement.ShowClearButton="True"
Height="34"/>
</DockPanel>
</hc:Col>
<hc:Col Span="8">
<Grid Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="榜单号" VerticalAlignment="Center"
FontSize="14" Foreground="{DynamicResource PrimaryTextBrush}"/>
<Border Grid.Column="1" CornerRadius="4" Height="34"
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
Background="{DynamicResource ThirdlyRegionBrush}">
<TextBlock Text="{Binding Entry.BillNo}" VerticalAlignment="Center"
Margin="8,0" FontSize="13" TextTrimming="CharacterEllipsis"
Foreground="{DynamicResource PrimaryTextBrush}"/>
</Border>
<Button Grid.Column="2" Content="选 择"
Command="{Binding OpenWeightRecordPickerCommand}"
Style="{StaticResource ButtonPrimary}"
Height="34" Margin="6,0,0,0" FontSize="12"/>
<Button Grid.Column="3"
Command="{Binding ClearWeightRecordCommand}"
Style="{StaticResource ButtonIcon}"
Height="34" Width="28" Margin="4,0,0,0" Padding="0"
ToolTip="清除榜单"
Foreground="{DynamicResource SecondaryTextBrush}"
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"/>
</Grid>
</hc:Col>
<hc:Col Span="8">
<hc:TextBox Text="{Binding Entry.SupplyCustomer, UpdateSourceTrigger=PropertyChanged}"
Height="34"
hc:InfoElement.Title="供料客户"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入供料客户"
hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:TextBox Text="{Binding Entry.SupplierName, UpdateSourceTrigger=PropertyChanged}"
Height="34"
hc:InfoElement.Title="供应商名称"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="根据榜单自动带出"
hc:InfoElement.ShowClearButton="True"
IsReadOnly="True"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:TextBox Text="{Binding Entry.ManufacturerMaterialName, UpdateSourceTrigger=PropertyChanged}"
Height="34"
hc:InfoElement.Title="厂家物料名称"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="自动带出厂家别名"
hc:InfoElement.ShowClearButton="True"
IsReadOnly="True"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:TextBox Text="{Binding Entry.ShelfLife, UpdateSourceTrigger=PropertyChanged}"
Height="34"
hc:InfoElement.Title="保质期"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="自动计算到期日期"
hc:InfoElement.ShowClearButton="True"
IsReadOnly="True"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:NumericUpDown Value="{Binding TotalWeightInput}"
Minimum="0"
DecimalPlaces="2"
Height="34"
Style="{StaticResource NumericUpDownPlus}"
hc:InfoElement.Title="总重(KG)"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入总重"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:NumericUpDown Value="{Binding TotalPortionsInput}"
Minimum="0"
DecimalPlaces="0"
Height="34"
Style="{StaticResource NumericUpDownPlus}"
hc:InfoElement.Title="总份数"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入总份数"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:NumericUpDown Value="{Binding Entry.PortionWeight}"
Minimum="0"
DecimalPlaces="2"
Height="34"
Style="{StaticResource NumericUpDownPlus}"
hc:InfoElement.Title="每份总重(KG)"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="自动按总重/总份数计算"
IsReadOnly="True"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:NumericUpDown Value="{Binding Entry.PortionPackages}"
Minimum="0"
DecimalPlaces="0"
Height="34"
Style="{StaticResource NumericUpDownPlus}"
hc:InfoElement.Title="每份包数"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入每份包数"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8" Visibility="Collapsed">
<hc:ComboBox SelectedValuePath="Value"
DisplayMemberPath="Key"
ItemsSource="{Binding TestResultOptions}"
SelectedValue="{Binding Entry.TestResult}"
Height="34"
hc:InfoElement.Title="检测结果"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请选择检测结果"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8" Visibility="Collapsed">
<hc:ComboBox SelectedValuePath="Value"
DisplayMemberPath="Key"
ItemsSource="{Binding TestStatusOptions}"
SelectedValue="{Binding Entry.TestStatus}"
Height="34"
hc:InfoElement.Title="检测状态"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请选择检测状态"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8" Visibility="Collapsed">
<hc:ComboBox SelectedValuePath="Value"
DisplayMemberPath="Key"
ItemsSource="{Binding PrintFlagOptions}"
SelectedValue="{Binding Entry.PrintFlag}"
Height="34"
hc:InfoElement.Title="打印标记"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请选择打印标记"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8" Visibility="Collapsed">
<hc:ComboBox SelectedValuePath="Value"
DisplayMemberPath="Key"
ItemsSource="{Binding StockBalanceOptions}"
SelectedValue="{Binding Entry.StockBalance}"
Height="34"
hc:InfoElement.Title="入库结存"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请选择入库结存"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:TextBox Text="{Binding Entry.WarehouseLocation, UpdateSourceTrigger=PropertyChanged}"
Height="34"
hc:InfoElement.Title="库位"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入库位"
hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:TextBox Text="{Binding Entry.UnloadOperator, UpdateSourceTrigger=PropertyChanged}"
Height="34"
hc:InfoElement.Title="卸货人"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入卸货人"
hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:ComboBox SelectedValuePath="Value"
DisplayMemberPath="Key"
ItemsSource="{Binding IsSpecialAdoptionOptions}"
SelectedValue="{Binding IsSpecialAdoptionValue}"
Height="34"
hc:InfoElement.Title="是否特采"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请选择是否特采"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:Col.Style>
<Style TargetType="hc:Col">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsSpecialAdoptionValue}" Value="1">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</hc:Col.Style>
<hc:TextBox Text="{Binding Entry.SpecialAdoptionOperator, UpdateSourceTrigger=PropertyChanged}"
Height="34"
hc:InfoElement.Title="特采操作人"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入特采操作人"
hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="8">
<hc:Col.Style>
<Style TargetType="hc:Col">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsSpecialAdoptionValue}" Value="1">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</hc:Col.Style>
<DockPanel Margin="0,0,0,8" LastChildFill="True">
<TextBlock DockPanel.Dock="Left" Text="特采时间" Width="80"
VerticalAlignment="Center"
Foreground="{DynamicResource PrimaryTextBrush}"/>
<hc:DateTimePicker SelectedDateTime="{Binding Entry.SpecialAdoptionTime}"
hc:InfoElement.Placeholder="请选择特采时间"
hc:InfoElement.ShowClearButton="True"
Height="34"/>
</DockPanel>
</hc:Col>
<hc:Col Span="8" Visibility="Collapsed">
<hc:ComboBox SelectedValuePath="Value"
DisplayMemberPath="Key"
ItemsSource="{Binding StatusOptions}"
SelectedValue="{Binding Entry.Status}"
Height="34"
hc:InfoElement.Title="状态"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请选择状态"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="24">
<hc:Col.Style>
<Style TargetType="hc:Col">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsSpecialAdoptionValue}" Value="1">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</hc:Col.Style>
<hc:TextBox Text="{Binding Entry.SpecialAdoptionReason, UpdateSourceTrigger=PropertyChanged}"
hc:InfoElement.Title="特采原因"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入特采原因"
hc:InfoElement.ShowClearButton="True"
TextWrapping="Wrap"
AcceptsReturn="True"
HorizontalAlignment="Stretch"
Height="64"
VerticalScrollBarVisibility="Auto"
Margin="0,0,0,8"/>
</hc:Col>
<hc:Col Span="24">
<hc:TextBox Text="{Binding Entry.Remark, UpdateSourceTrigger=PropertyChanged}"
hc:InfoElement.Title="备注"
hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入备注"
hc:InfoElement.ShowClearButton="True"
TextWrapping="Wrap"
AcceptsReturn="True"
HorizontalAlignment="Stretch"
Height="64"
VerticalScrollBarVisibility="Auto"
Margin="0,0,0,8"/>
</hc:Col>
</hc:Row>
<!-- 拆码明细:移出 hc:Row 避免被行高限制裁剪 -->
<Border BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" CornerRadius="6" Padding="12" Margin="0,4,0,8">
<StackPanel>
<DockPanel Margin="0,0,0,10">
<TextBlock Text="拆码明细"
FontSize="14"
FontWeight="SemiBold"
Foreground="{DynamicResource PrimaryTextBrush}"
VerticalAlignment="Center"/>
<Button DockPanel.Dock="Right"
Content="新增明细"
Command="{Binding AddSplitDetailCommand}"
Style="{StaticResource ButtonPrimary}"
Height="30"
Padding="10,0"
FontSize="12"/>
</DockPanel>
<DataGrid ItemsSource="{Binding SplitCodeDetails}"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
HeadersVisibility="Column"
GridLinesVisibility="Horizontal"
HorizontalGridLinesBrush="#FFEDEDED"
VerticalGridLinesBrush="Transparent"
MinHeight="80"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Disabled"
ColumnHeaderStyle="{StaticResource CusDataGridColumnHeaderStyle}"
Style="{StaticResource CusDataGridStyle}">
<DataGrid.Columns>
<DataGridTextColumn Header="份数"
Binding="{Binding Portions, UpdateSourceTrigger=PropertyChanged}"
Width="80"
CellStyle="{StaticResource CusDataGridCellStyle}"/>
<DataGridTextColumn Header="每份重量(KG)"
Binding="{Binding PortionWeight, UpdateSourceTrigger=PropertyChanged, StringFormat=N2}"
Width="130"
CellStyle="{StaticResource CusDataGridCellStyle}"/>
<DataGridTextColumn Header="每份包数"
Binding="{Binding PortionPackages, UpdateSourceTrigger=PropertyChanged}"
Width="100"
CellStyle="{StaticResource CusDataGridCellStyle}"/>
<DataGridTextColumn Header="库位"
Binding="{Binding WarehouseLocation, UpdateSourceTrigger=PropertyChanged}"
Width="*"
CellStyle="{StaticResource CusDataGridCellStyle}"/>
<DataGridTemplateColumn Header="操作" Width="90">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="删除"
Command="{Binding DataContext.RemoveSplitDetailCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
CommandParameter="{Binding}"
Style="{StaticResource ButtonDanger}"
Padding="6,2" Margin="4,2" FontSize="11"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</Border>
</StackPanel>
</hc:ScrollViewer>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,12,0,20">
<Button Content="重置" Command="{Binding ResetCommand}" Style="{StaticResource ButtonDefault}" Margin="0,0,15,0" Width="100"/>
<Button Content="保存" Command="{Binding SaveCommand}" Style="{StaticResource ButtonPrimary}" Width="100"/>
</StackPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,30 @@
using System.Windows;
using System.Windows.Controls;
using YY.Admin.ViewModels.RawMaterialEntry;
namespace YY.Admin.Views.RawMaterialEntry;
public partial class RawMaterialEntryOperationView : UserControl
{
private bool _initialized;
public RawMaterialEntryOperationView()
{
InitializeComponent();
Loaded += OnLoaded;
}
private void OnLoaded(object sender, RoutedEventArgs e)
{
if (_initialized)
{
return;
}
if (DataContext is RawMaterialEntryEditDialogViewModel vm)
{
vm.InitializeForAdd();
_initialized = true;
}
}
}

View File

@@ -0,0 +1,172 @@
<UserControl x:Class="YY.Admin.Views.RawMaterialEntry.WeightRecordPickerDialogView"
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:hc="https://handyorg.github.io/handycontrol"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d"
Width="760">
<Grid Background="{DynamicResource ThirdlyRegionBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="360"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<hc:SimplePanel Margin="20,16,20,12">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Border Width="32" Height="32" CornerRadius="6" Background="{DynamicResource PrimaryBrush}" Margin="0,0,10,0">
<md:PackIcon Kind="FileDocumentOutline" Width="18" Height="18" Foreground="White"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<TextBlock Text="选择榜单号(自动带出供应商)" FontSize="16" FontWeight="SemiBold"
Foreground="{DynamicResource PrimaryTextBrush}" VerticalAlignment="Center"/>
</StackPanel>
<Button Width="22" Height="22" Command="hc:ControlCommands.Close"
Style="{StaticResource ButtonIcon}"
Foreground="{DynamicResource PrimaryBrush}"
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"
Padding="0" HorizontalAlignment="Right" VerticalAlignment="Center"/>
</hc:SimplePanel>
<Border Grid.Row="1" Background="{DynamicResource RegionBrush}" Padding="16,10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<hc:TextBox Text="{Binding SearchBillNo, UpdateSourceTrigger=PropertyChanged}"
hc:InfoElement.Placeholder="输入榜单号搜索..."
hc:InfoElement.ShowClearButton="True"
Margin="0,0,8,0">
<hc:TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding SearchCommand}"/>
</hc:TextBox.InputBindings>
</hc:TextBox>
<hc:TextBox Grid.Column="1"
Text="{Binding SearchPlateNumber, UpdateSourceTrigger=PropertyChanged}"
hc:InfoElement.Placeholder="输入车牌号搜索..."
hc:InfoElement.ShowClearButton="True"
Margin="0,0,8,0">
<hc:TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding SearchCommand}"/>
</hc:TextBox.InputBindings>
</hc:TextBox>
<Button Grid.Column="2" Command="{Binding SearchCommand}"
IsEnabled="{Binding IsLoading, Converter={StaticResource Boolean2BooleanReConverter}}"
Style="{StaticResource ButtonPrimary}" Height="32">
<StackPanel Orientation="Horizontal">
<md:PackIcon Kind="Magnify" Width="14" Height="14" VerticalAlignment="Center" Margin="0,0,4,0"/>
<TextBlock Text="搜索" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Button>
</Grid>
</Border>
<DataGrid x:Name="WeightRecordsGrid"
Grid.Row="2"
Margin="16,8,16,0"
ItemsSource="{Binding Records}"
SelectedItem="{Binding SelectedRecord}"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserResizeRows="False"
HeadersVisibility="Column"
SelectionMode="Single"
SelectionUnit="FullRow"
IsReadOnly="True"
GridLinesVisibility="Horizontal"
HorizontalGridLinesBrush="#FFEDEFF2"
VerticalGridLinesBrush="Transparent"
Background="White"
RowBackground="White"
AlternatingRowBackground="#FAFCFF"
RowHeight="32"
ColumnHeaderHeight="34"
RowHeaderWidth="0"
MouseDoubleClick="WeightRecordsGrid_MouseDoubleClick">
<DataGrid.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#EAF3FF"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#1F1F1F"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#EAF3FF"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#1F1F1F"/>
</DataGrid.Resources>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#F5F7FA"/>
<Setter Property="Foreground" Value="#606266"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="8,0"/>
<Setter Property="BorderBrush" Value="#EBEEF5"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="#262626"/>
<Setter Property="BorderBrush" Value="#FFEDEFF2"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#EAF3FF"/>
<Setter Property="Foreground" Value="#1F1F1F"/>
<Setter Property="BorderBrush" Value="#D6E8FF"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#F5F9FF"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="8,0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="榜单号" Binding="{Binding BillNo}" Width="180"/>
<DataGridTextColumn Header="车牌号" Binding="{Binding PlateNumber}" Width="120"/>
<DataGridTextColumn Header="供应商(发货单位)" Binding="{Binding SenderUnit}" Width="*"/>
<DataGridTextColumn Header="称重日期" Binding="{Binding WeighDate, StringFormat='yyyy-MM-dd'}" Width="120"/>
</DataGrid.Columns>
</DataGrid>
<Border Grid.Row="3" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0"
Padding="16,12">
<Grid>
<TextBlock VerticalAlignment="Center" FontSize="13" MaxWidth="420"
TextTrimming="CharacterEllipsis" HorizontalAlignment="Left"
Text="{Binding SelectedRecordDisplay}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasSelectedRecord}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="取 消" Command="{Binding CancelCommand}"
Style="{StaticResource ButtonDefault}" Width="88" Margin="0,0,12,0" Height="34"/>
<Button Content="确认选择" Command="{Binding ConfirmCommand}"
Style="{StaticResource ButtonPrimary}" Width="100" Height="34"/>
</StackPanel>
</Grid>
</Border>
</Grid>
</UserControl>

View File

@@ -0,0 +1,21 @@
using System.Windows.Controls;
using System.Windows.Input;
using YY.Admin.ViewModels.RawMaterialEntry;
namespace YY.Admin.Views.RawMaterialEntry;
public partial class WeightRecordPickerDialogView : UserControl
{
public WeightRecordPickerDialogView()
{
InitializeComponent();
}
private void WeightRecordsGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (DataContext is WeightRecordPickerDialogViewModel vm && vm.ConfirmCommand.CanExecute())
{
vm.ConfirmCommand.Execute();
}
}
}