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

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

@@ -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>