新增原料入场记录功能,包含免密接口和数据同步,更新相关控制器、实体和服务,支持条码/批次号生成及管理,优化用户体验和系统实时数据处理能力。

This commit is contained in:
geht
2026-05-09 15:55:11 +08:00
parent 64e978a618
commit 16bb22a113
38 changed files with 2398 additions and 10 deletions

View File

@@ -0,0 +1,400 @@
<UserControl x:Class="YY.Admin.Views.RawMaterialEntry.RawMaterialEntryEditDialogView"
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"
Width="1280"
MinWidth="1100"
MinHeight="500">
<Grid Background="{DynamicResource ThirdlyRegionBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 标题栏 -->
<hc:SimplePanel Margin="24,20,24,12">
<TextBlock FontSize="18" Foreground="{DynamicResource PrimaryTextBrush}" Text="{Binding DialogTitle}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<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>
<!-- 表单区域 -->
<hc:ScrollViewer Grid.Row="1" IsInertiaEnabled="True">
<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>
</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"
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"
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">
<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"/>
</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"
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"
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"
Margin="0,0,0,8"/>
</hc:Col>
<!-- 总重(KG) -->
<hc:Col Span="8">
<hc:NumericUpDown Value="{Binding Entry.TotalWeight}"
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 Entry.TotalPortions}"
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>
<!-- 每份总重(KG) -->
<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="请输入每份总重"
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">
<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">
<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">
<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">
<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 Entry.IsSpecialAdoption}"
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.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">
<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">
<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: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>
</StackPanel>
</hc:ScrollViewer>
<!-- 按钮区域 -->
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,12,0,20">
<Button Content="取消" Command="{Binding CancelCommand}" Style="{StaticResource ButtonDefault}" Margin="0,0,15,0" Width="100"/>
<Button Content="确定" Command="{Binding SaveCommand}" Style="{StaticResource ButtonPrimary}" Width="100"/>
</StackPanel>
</Grid>
</UserControl>