优化原料入场记录编辑对话框,新增拆码明细的显示逻辑,增强用户体验。更新前端视图以支持拆码明细的自动拼接显示,并调整相关控件的布局和样式。

This commit is contained in:
geht
2026-05-09 19:10:42 +08:00
parent 0e89648e8a
commit 936375bb2c
6 changed files with 272 additions and 226 deletions

View File

@@ -1,6 +1,9 @@
using HandyControl.Controls; using HandyControl.Controls;
using HandyControl.Tools.Extension; using HandyControl.Tools.Extension;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Globalization;
using YY.Admin.Core; using YY.Admin.Core;
using YY.Admin.Core.Entity; using YY.Admin.Core.Entity;
using YY.Admin.Core.Services; using YY.Admin.Core.Services;
@@ -117,6 +120,9 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
public ObservableCollection<KeyValuePair<string, string>> StatusOptions { get; } = new(); public ObservableCollection<KeyValuePair<string, string>> StatusOptions { get; } = new();
public ObservableCollection<RawMaterialSplitDetailItem> SplitCodeDetails { get; } = new(); public ObservableCollection<RawMaterialSplitDetailItem> SplitCodeDetails { get; } = new();
public double SplitCodeTableHeight => CalculateSplitCodeTableHeight(); public double SplitCodeTableHeight => CalculateSplitCodeTableHeight();
public string SplitTotalPortionsDisplay => JoinSplitValue(item => item.Portions?.ToString(CultureInfo.InvariantCulture), true);
public string SplitPortionWeightDisplay => JoinSplitValue(item => FormatNullableDecimal(item.PortionWeight), true);
public string SplitPortionPackagesDisplay => JoinSplitValue(item => item.PortionPackages?.ToString(CultureInfo.InvariantCulture), true);
private bool _result; private bool _result;
public bool Result { get => _result; set => SetProperty(ref _result, value); } public bool Result { get => _result; set => SetProperty(ref _result, value); }
@@ -151,7 +157,7 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
ClearMaterialCommand = new DelegateCommand(ClearMaterialSelection); ClearMaterialCommand = new DelegateCommand(ClearMaterialSelection);
OpenWeightRecordPickerCommand = new DelegateCommand(async () => await OpenWeightRecordPickerAsync()); OpenWeightRecordPickerCommand = new DelegateCommand(async () => await OpenWeightRecordPickerAsync());
ClearWeightRecordCommand = new DelegateCommand(ClearWeightRecordSelection); ClearWeightRecordCommand = new DelegateCommand(ClearWeightRecordSelection);
SplitCodeDetails.CollectionChanged += (_, _) => RaisePropertyChanged(nameof(SplitCodeTableHeight)); SplitCodeDetails.CollectionChanged += OnSplitCodeDetailsCollectionChanged;
_ = LoadAllAsync(); _ = LoadAllAsync();
} }
@@ -298,6 +304,9 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
RaisePropertyChanged(nameof(TotalWeightInput)); RaisePropertyChanged(nameof(TotalWeightInput));
RaisePropertyChanged(nameof(TotalPortionsInput)); RaisePropertyChanged(nameof(TotalPortionsInput));
RaisePropertyChanged(nameof(IsSpecialAdoptionValue)); RaisePropertyChanged(nameof(IsSpecialAdoptionValue));
RaisePropertyChanged(nameof(SplitTotalPortionsDisplay));
RaisePropertyChanged(nameof(SplitPortionWeightDisplay));
RaisePropertyChanged(nameof(SplitPortionPackagesDisplay));
} }
public void InitializeForEdit(MesXslRawMaterialEntry entry) public void InitializeForEdit(MesXslRawMaterialEntry entry)
@@ -339,6 +348,9 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
RaisePropertyChanged(nameof(TotalWeightInput)); RaisePropertyChanged(nameof(TotalWeightInput));
RaisePropertyChanged(nameof(TotalPortionsInput)); RaisePropertyChanged(nameof(TotalPortionsInput));
RaisePropertyChanged(nameof(IsSpecialAdoptionValue)); RaisePropertyChanged(nameof(IsSpecialAdoptionValue));
RaisePropertyChanged(nameof(SplitTotalPortionsDisplay));
RaisePropertyChanged(nameof(SplitPortionWeightDisplay));
RaisePropertyChanged(nameof(SplitPortionPackagesDisplay));
} }
private async Task SaveAsync() private async Task SaveAsync()
@@ -548,6 +560,71 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
RaisePropertyChanged(nameof(SplitCodeTableHeight)); RaisePropertyChanged(nameof(SplitCodeTableHeight));
} }
private void OnSplitCodeDetailsCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
if (e.OldItems != null)
{
foreach (var oldItem in e.OldItems.OfType<RawMaterialSplitDetailItem>())
{
oldItem.PropertyChanged -= OnSplitDetailItemPropertyChanged;
}
}
if (e.NewItems != null)
{
foreach (var newItem in e.NewItems.OfType<RawMaterialSplitDetailItem>())
{
newItem.PropertyChanged += OnSplitDetailItemPropertyChanged;
}
}
RaiseSplitDisplayPropertyChanged();
RaisePropertyChanged(nameof(SplitCodeTableHeight));
}
private void OnSplitDetailItemPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(RawMaterialSplitDetailItem.Portions)
or nameof(RawMaterialSplitDetailItem.PortionWeight)
or nameof(RawMaterialSplitDetailItem.PortionPackages))
{
RaiseSplitDisplayPropertyChanged();
}
}
private void RaiseSplitDisplayPropertyChanged()
{
RaisePropertyChanged(nameof(SplitTotalPortionsDisplay));
RaisePropertyChanged(nameof(SplitPortionWeightDisplay));
RaisePropertyChanged(nameof(SplitPortionPackagesDisplay));
}
private string JoinSplitValue(Func<RawMaterialSplitDetailItem, string?> selector, bool withTrailingSlash)
{
var values = SplitCodeDetails
.Select(selector)
.Where(x => !string.IsNullOrWhiteSpace(x))
.Select(x => x!.Trim())
.ToList();
if (values.Count == 0)
{
return string.Empty;
}
var joined = string.Join("/", values);
return withTrailingSlash ? $"{joined}/" : joined;
}
private static string? FormatNullableDecimal(double? value)
{
if (!value.HasValue)
{
return null;
}
return value.Value.ToString("0.##", CultureInfo.InvariantCulture);
}
private void ApplyFirstSplitDetailToEntry() private void ApplyFirstSplitDetailToEntry()
{ {
if (Entry == null || SplitCodeDetails.Count == 0) if (Entry == null || SplitCodeDetails.Count == 0)

View File

@@ -25,10 +25,15 @@
<hc:ScrollViewer Grid.Row="1" IsInertiaEnabled="True" HorizontalScrollBarVisibility="Disabled"> <hc:ScrollViewer Grid.Row="1" IsInertiaEnabled="True" HorizontalScrollBarVisibility="Disabled">
<StackPanel x:Name="RootPanel" Margin="24,8,24,8"> <StackPanel x:Name="RootPanel" Margin="24,8,24,8">
<TextBlock Text="基础资料"
FontSize="14"
FontWeight="SemiBold"
Foreground="{DynamicResource PrimaryTextBrush}"
Margin="0,0,0,6"/>
<hc:Row Gutter="16"> <hc:Row Gutter="16">
<hc:Col Span="16"> <hc:Col Span="16">
<Grid Margin="0,0,0,8"> <Grid Margin="0,0,0,4">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/> <ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
@@ -76,7 +81,7 @@
hc:InfoElement.TitleWidth="80" hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
Foreground="{DynamicResource SecondaryTextBrush}" Foreground="{DynamicResource SecondaryTextBrush}"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
@@ -88,7 +93,7 @@
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="自动生成" hc:InfoElement.Placeholder="自动生成"
hc:InfoElement.ShowClearButton="True" hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
@@ -100,11 +105,11 @@
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="自动生成" hc:InfoElement.Placeholder="自动生成"
hc:InfoElement.ShowClearButton="True" hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
<DockPanel Margin="0,0,0,8" LastChildFill="True"> <DockPanel Margin="0,0,0,4" LastChildFill="True">
<TextBlock DockPanel.Dock="Left" Text="入场时间" Width="80" <TextBlock DockPanel.Dock="Left" Text="入场时间" Width="80"
VerticalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource PrimaryTextBrush}"/> Foreground="{DynamicResource PrimaryTextBrush}"/>
@@ -116,7 +121,7 @@
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
<Grid Margin="0,0,0,8"> <Grid Margin="0,0,0,4">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/> <ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
@@ -154,7 +159,7 @@
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入供料客户" hc:InfoElement.Placeholder="请输入供料客户"
hc:InfoElement.ShowClearButton="True" hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
@@ -166,7 +171,7 @@
hc:InfoElement.Placeholder="根据榜单自动带出" hc:InfoElement.Placeholder="根据榜单自动带出"
hc:InfoElement.ShowClearButton="True" hc:InfoElement.ShowClearButton="True"
IsReadOnly="True" IsReadOnly="True"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
@@ -178,7 +183,7 @@
hc:InfoElement.Placeholder="自动带出厂家别名" hc:InfoElement.Placeholder="自动带出厂家别名"
hc:InfoElement.ShowClearButton="True" hc:InfoElement.ShowClearButton="True"
IsReadOnly="True" IsReadOnly="True"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
@@ -190,7 +195,7 @@
hc:InfoElement.Placeholder="自动计算到期日期" hc:InfoElement.Placeholder="自动计算到期日期"
hc:InfoElement.ShowClearButton="True" hc:InfoElement.ShowClearButton="True"
IsReadOnly="True" IsReadOnly="True"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
@@ -203,99 +208,40 @@
hc:InfoElement.TitleWidth="80" hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入总重" hc:InfoElement.Placeholder="请输入总重"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
<hc:NumericUpDown Value="{Binding TotalPortionsInput}" <hc:TextBox Text="{Binding SplitTotalPortionsDisplay, Mode=OneWay}"
Minimum="0"
DecimalPlaces="0"
Height="34" Height="34"
Style="{StaticResource NumericUpDownPlus}"
hc:InfoElement.Title="总份数" hc:InfoElement.Title="总份数"
hc:InfoElement.TitleWidth="80" hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入总份数" hc:InfoElement.Placeholder="根据拆码明细自动拼接"
Margin="0,0,0,8"/> IsReadOnly="True"
Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
<hc:NumericUpDown Value="{Binding Entry.PortionWeight}" <hc:TextBox Text="{Binding SplitPortionWeightDisplay, Mode=OneWay}"
Minimum="0"
DecimalPlaces="2"
Height="34" Height="34"
Style="{StaticResource NumericUpDownPlus}"
hc:InfoElement.Title="每份总重(KG)" hc:InfoElement.Title="每份总重(KG)"
hc:InfoElement.TitleWidth="80" hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="自动按总重/总份数计算" hc:InfoElement.Placeholder="根据拆码明细自动拼接"
IsReadOnly="True" IsReadOnly="True"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
<hc:NumericUpDown Value="{Binding Entry.PortionPackages}" <hc:TextBox Text="{Binding SplitPortionPackagesDisplay, Mode=OneWay}"
Minimum="0"
DecimalPlaces="0"
Height="34" Height="34"
Style="{StaticResource NumericUpDownPlus}"
hc:InfoElement.Title="每份包数" hc:InfoElement.Title="每份包数"
hc:InfoElement.TitleWidth="80" hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入每份包数" hc:InfoElement.Placeholder="根据拆码明细自动拼接"
Margin="0,0,0,8"/> IsReadOnly="True"
</hc:Col> Margin="0,0,0,4"/>
<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>
<hc:Col Span="8"> <hc:Col Span="8">
@@ -306,7 +252,7 @@
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入库位" hc:InfoElement.Placeholder="请输入库位"
hc:InfoElement.ShowClearButton="True" hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
@@ -317,7 +263,7 @@
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请输入卸货人" hc:InfoElement.Placeholder="请输入卸货人"
hc:InfoElement.ShowClearButton="True" hc:InfoElement.ShowClearButton="True"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
<hc:Col Span="8"> <hc:Col Span="8">
@@ -330,88 +276,7 @@
hc:InfoElement.TitleWidth="80" hc:InfoElement.TitleWidth="80"
hc:InfoElement.TitlePlacement="Left" hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Placeholder="请选择是否特采" hc:InfoElement.Placeholder="请选择是否特采"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</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>
<hc:Col Span="24"> <hc:Col Span="24">
@@ -426,13 +291,64 @@
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
Height="64" Height="64"
VerticalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
Margin="0,0,0,8"/> Margin="0,0,0,4"/>
</hc:Col> </hc:Col>
</hc:Row> </hc:Row>
<StackPanel>
<StackPanel.Style>
<Style TargetType="StackPanel">
<Setter Property="Visibility" Value="Collapsed"/>
<Setter Property="Margin" Value="0"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsSpecialAdoptionValue}" Value="1">
<Setter Property="Visibility" Value="Visible"/>
<Setter Property="Margin" Value="0,0,0,4"/>
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<hc:Row Gutter="16">
<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,4"/>
</hc:Col>
<hc:Col Span="8">
<DockPanel Margin="0,0,0,4" 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:Row>
<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,4"/>
</StackPanel>
<!-- 拆码明细:移出 hc:Row 避免被行高限制裁剪 --> <!-- 拆码明细:移出 hc:Row 避免被行高限制裁剪 -->
<Border BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" CornerRadius="6" Padding="12" Margin="0,4,0,8"> <Border BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" CornerRadius="6" Padding="12" Margin="0,0,0,8">
<StackPanel> <StackPanel>
<DockPanel Margin="0,0,0,10"> <DockPanel Margin="0,0,0,10">
<TextBlock Text="拆码明细" <TextBlock Text="拆码明细"
@@ -449,51 +365,104 @@
FontSize="12"/> FontSize="12"/>
</DockPanel> </DockPanel>
<DataGrid ItemsSource="{Binding SplitCodeDetails}" <StackPanel>
AutoGenerateColumns="False" <!-- 表头 -->
CanUserAddRows="False" <Grid Background="{DynamicResource SecondaryRegionBrush}" Height="40">
CanUserDeleteRows="False" <Grid.ColumnDefinitions>
CanUserReorderColumns="False" <ColumnDefinition Width="80"/>
CanUserResizeColumns="False" <ColumnDefinition Width="130"/>
HeadersVisibility="Column" <ColumnDefinition Width="100"/>
GridLinesVisibility="Horizontal" <ColumnDefinition Width="*"/>
HorizontalGridLinesBrush="#FFEDEDED" <ColumnDefinition Width="90"/>
VerticalGridLinesBrush="Transparent" </Grid.ColumnDefinitions>
MinHeight="80" <TextBlock Grid.Column="0" Text="份数"
HorizontalScrollBarVisibility="Disabled" HorizontalAlignment="Center" VerticalAlignment="Center"
VerticalScrollBarVisibility="Disabled" FontWeight="SemiBold" FontSize="13"
ColumnHeaderStyle="{StaticResource CusDataGridColumnHeaderStyle}" Foreground="{DynamicResource PrimaryTextBrush}"/>
Style="{StaticResource CusDataGridStyle}"> <TextBlock Grid.Column="1" Text="每份重量(KG)"
<DataGrid.Columns> HorizontalAlignment="Center" VerticalAlignment="Center"
<DataGridTextColumn Header="份数" FontWeight="SemiBold" FontSize="13"
Binding="{Binding Portions, UpdateSourceTrigger=PropertyChanged}" Foreground="{DynamicResource PrimaryTextBrush}"/>
Width="80" <TextBlock Grid.Column="2" Text="每份包数"
CellStyle="{StaticResource CusDataGridCellStyle}"/> HorizontalAlignment="Center" VerticalAlignment="Center"
<DataGridTextColumn Header="每份重量(KG)" FontWeight="SemiBold" FontSize="13"
Binding="{Binding PortionWeight, UpdateSourceTrigger=PropertyChanged, StringFormat=N2}" Foreground="{DynamicResource PrimaryTextBrush}"/>
Width="130" <TextBlock Grid.Column="3" Text="库位"
CellStyle="{StaticResource CusDataGridCellStyle}"/> HorizontalAlignment="Center" VerticalAlignment="Center"
<DataGridTextColumn Header="每份包数" FontWeight="SemiBold" FontSize="13"
Binding="{Binding PortionPackages, UpdateSourceTrigger=PropertyChanged}" Foreground="{DynamicResource PrimaryTextBrush}"/>
Width="100" <TextBlock Grid.Column="4" Text="操作"
CellStyle="{StaticResource CusDataGridCellStyle}"/> HorizontalAlignment="Center" VerticalAlignment="Center"
<DataGridTextColumn Header="库位" FontWeight="SemiBold" FontSize="13"
Binding="{Binding WarehouseLocation, UpdateSourceTrigger=PropertyChanged}" Foreground="{DynamicResource PrimaryTextBrush}"/>
Width="*" </Grid>
CellStyle="{StaticResource CusDataGridCellStyle}"/>
<DataGridTemplateColumn Header="操作" Width="90"> <!-- 空状态提示 -->
<DataGridTemplateColumn.CellTemplate> <TextBlock Text="暂无明细,请点击「新增明细」添加"
HorizontalAlignment="Center"
Foreground="{DynamicResource SecondaryTextBrush}"
FontSize="12"
Margin="0,14">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding SplitCodeDetails.Count}" Value="0">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<!-- 数据行 -->
<ItemsControl ItemsSource="{Binding SplitCodeDetails}">
<ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid Height="36">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="90"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
<TextBox Text="{Binding Portions, UpdateSourceTrigger=PropertyChanged}"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
BorderBrush="#D9D9D9" BorderThickness="1"
Background="White" FontSize="13" Margin="4,4"/>
</Border>
<Border Grid.Column="1" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
<TextBox Text="{Binding PortionWeight, UpdateSourceTrigger=PropertyChanged}"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
BorderBrush="#D9D9D9" BorderThickness="1"
Background="White" FontSize="13" Margin="4,4"/>
</Border>
<Border Grid.Column="2" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
<TextBox Text="{Binding PortionPackages, UpdateSourceTrigger=PropertyChanged}"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
BorderBrush="#D9D9D9" BorderThickness="1"
Background="White" FontSize="13" Margin="4,4"/>
</Border>
<Border Grid.Column="3" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
<TextBox Text="{Binding WarehouseLocation, UpdateSourceTrigger=PropertyChanged}"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
BorderBrush="#D9D9D9" BorderThickness="1"
Background="White" FontSize="13" Padding="8,0" Margin="4,4"/>
</Border>
<Border Grid.Column="4" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
<Button Content="删除" <Button Content="删除"
Command="{Binding DataContext.RemoveSplitDetailCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}" Command="{Binding DataContext.RemoveSplitDetailCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
CommandParameter="{Binding}" CommandParameter="{Binding}"
Style="{StaticResource ButtonDanger}" Style="{StaticResource ButtonDanger}"
Padding="6,2" Margin="4,2" FontSize="11"/> Padding="6,2" Margin="12,4" FontSize="11"/>
</Border>
</Grid>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </ItemsControl.ItemTemplate>
</DataGridTemplateColumn> </ItemsControl>
</DataGrid.Columns> </StackPanel>
</DataGrid>
</StackPanel> </StackPanel>
</Border> </Border>
</StackPanel> </StackPanel>