This commit is contained in:
GukSang.Jin
2026-03-21 10:24:26 +08:00
parent 54424c432d
commit 30784d1f1f
2 changed files with 68 additions and 63 deletions

View File

@@ -21,64 +21,69 @@
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border Grid.Row="0" Padding="20" CornerRadius="22" Background="{StaticResource HeroBrush}"> <Border Grid.Row="0" Padding="14,12" CornerRadius="18" Background="{StaticResource HeroBrush}">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.ColumnDefinitions>
<RowDefinition Height="Auto" /> <ColumnDefinition Width="*" />
<RowDefinition Height="Auto" /> <ColumnDefinition Width="Auto" />
<RowDefinition Height="Auto" /> </Grid.ColumnDefinitions>
</Grid.RowDefinitions> <StackPanel VerticalAlignment="Center">
<StackPanel> <TextBlock Text="{Binding PageTitle}"
<TextBlock Text="{Binding PageTitle}" FontSize="28" FontWeight="Bold" Foreground="White" TextWrapping="Wrap" /> FontSize="21"
<TextBlock Margin="0,6,0,0" Foreground="#D9F6F9" FontSize="14" Text="检测、记录、追溯一体化工作台" TextWrapping="Wrap" /> FontWeight="Bold"
</StackPanel> Foreground="White"
<WrapPanel Grid.Row="1" Margin="0,14,0,0"> TextTrimming="CharacterEllipsis" />
<Border Style="{StaticResource PillBorderStyle}"> <WrapPanel Margin="0,8,0,0">
<StackPanel> <Border Style="{StaticResource PillBorderStyle}" Padding="12,6" Margin="0,0,8,6">
<TextBlock Foreground="#D9F6F9" FontSize="12" Text="当前阶段" /> <StackPanel>
<TextBlock Foreground="White" FontSize="16" FontWeight="Bold" Text="{Binding CurrentStage}" /> <TextBlock Foreground="#D9F6F9" FontSize="11" Text="阶段" />
</StackPanel> <TextBlock Foreground="White" FontSize="14" FontWeight="Bold" Text="{Binding CurrentStage}" />
</Border> </StackPanel>
<Border Style="{StaticResource PillBorderStyle}"> </Border>
<StackPanel> <Border Style="{StaticResource PillBorderStyle}" Padding="12,6" Margin="0,0,8,6">
<TextBlock Foreground="#D9F6F9" FontSize="12" Text="设备状态" /> <StackPanel>
<TextBlock Foreground="White" FontSize="16" FontWeight="Bold" Text="{Binding DeviceStatus}" /> <TextBlock Foreground="#D9F6F9" FontSize="11" Text="设备" />
</StackPanel> <TextBlock Foreground="White" FontSize="14" FontWeight="Bold" Text="{Binding DeviceStatus}" />
</Border> </StackPanel>
<Border Style="{StaticResource PillBorderStyle}"> </Border>
<StackPanel> <Border Style="{StaticResource PillBorderStyle}" Padding="12,6" Margin="0,0,8,6">
<TextBlock Foreground="#D9F6F9" FontSize="12" Text="实时告警" /> <StackPanel>
<TextBlock Foreground="White" FontSize="16" FontWeight="Bold" Text="{Binding AlarmSummaryDisplay}" /> <TextBlock Foreground="#D9F6F9" FontSize="11" Text="告警" />
</StackPanel> <TextBlock Foreground="White" FontSize="14" FontWeight="Bold" Text="{Binding AlarmSummaryDisplay}" />
</Border> </StackPanel>
<Border Style="{StaticResource PillBorderStyle}"> </Border>
<StackPanel> <Border Style="{StaticResource PillBorderStyle}" Padding="12,6" Margin="0,0,8,6">
<TextBlock Foreground="#D9F6F9" FontSize="12" Text="合格率" /> <StackPanel>
<TextBlock Foreground="White" FontSize="16" FontWeight="Bold" Text="{Binding ComplianceDisplay}" /> <TextBlock Foreground="#D9F6F9" FontSize="11" Text="待处理" />
</StackPanel> <TextBlock Foreground="White" FontSize="14" FontWeight="Bold" Text="{Binding PendingCount}" />
</Border> </StackPanel>
<Border Style="{StaticResource PillBorderStyle}"> </Border>
<StackPanel> <Border Style="{StaticResource PillBorderStyle}" Padding="12,6" Margin="0,0,0,6">
<TextBlock Foreground="#D9F6F9" FontSize="12" Text="合格项" /> <StackPanel>
<TextBlock Foreground="White" FontSize="16" FontWeight="Bold" Text="{Binding QualifiedCount}" /> <TextBlock Foreground="#D9F6F9" FontSize="11" Text="合格率" />
</StackPanel> <TextBlock Foreground="White" FontSize="14" FontWeight="Bold" Text="{Binding ComplianceDisplay}" />
</Border> </StackPanel>
<Border Style="{StaticResource PillBorderStyle}"> </Border>
<StackPanel>
<TextBlock Foreground="#D9F6F9" FontSize="12" Text="待处理" />
<TextBlock Foreground="White" FontSize="16" FontWeight="Bold" Text="{Binding PendingCount}" />
</StackPanel>
</Border>
</WrapPanel>
<StackPanel Grid.Row="2" Margin="0,10,0,0">
<WrapPanel>
<Button Command="{Binding ToggleAcquisitionCommand}" Content="采集" Background="#FFFFFFFF" Foreground="{StaticResource HeaderBrush}" />
<Button Command="{Binding AcknowledgeAlarmCommand}" Content="消警" Background="#33FFFFFF" />
<Button Command="{Binding CompleteDetectionCommand}" Content="完成检测" Background="#FFF0B145" />
<Button Command="{Binding ExportReportCommand}" Content="导出 PDF" Background="#FFEA7E3C" />
</WrapPanel> </WrapPanel>
<TextBlock Margin="0,2,0,0" Foreground="#EFFAFC" FontSize="14" Text="{Binding ExportStateText}" TextWrapping="Wrap" /> <TextBlock Margin="0,4,0,0"
<TextBlock Margin="0,6,0,0" Foreground="#EFFAFC" FontSize="14" Text="{Binding LatestAction}" TextWrapping="Wrap" /> Foreground="#EFFAFC"
FontSize="12"
Text="{Binding LatestAction}"
TextTrimming="CharacterEllipsis" />
</StackPanel>
<StackPanel Grid.Column="1" Margin="16,0,0,0" VerticalAlignment="Center">
<WrapPanel HorizontalAlignment="Right">
<Button MinWidth="92" MinHeight="36" Padding="12,7" Margin="0,0,8,8" Command="{Binding ToggleAcquisitionCommand}" Content="采集" Background="#FFFFFFFF" Foreground="{StaticResource HeaderBrush}" />
<Button MinWidth="92" MinHeight="36" Padding="12,7" Margin="0,0,8,8" Command="{Binding AcknowledgeAlarmCommand}" Content="消警" Background="#33FFFFFF" />
<Button MinWidth="108" MinHeight="36" Padding="12,7" Margin="0,0,8,8" Command="{Binding CompleteDetectionCommand}" Content="完成检测" Background="#FFF0B145" />
<Button MinWidth="136" MinHeight="36" Padding="12,7" Margin="0,0,0,8" Command="{Binding ExportReportCommand}" Content="导出检查报告" Background="#FFEA7E3C" />
</WrapPanel>
<TextBlock HorizontalAlignment="Right"
Foreground="#EFFAFC"
FontSize="12"
Text="{Binding ExportStateText}"
TextWrapping="Wrap" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</Border> </Border>

View File

@@ -262,7 +262,7 @@ public partial class MainViewModel : ObservableObject
public string ComplianceDisplay => $"{ComplianceRate:F0}%"; public string ComplianceDisplay => $"{ComplianceRate:F0}%";
public string DeltaPressureDisplay => HasChannelTelemetry("近端压力", "远端压力") ? $"{DeltaPressure:F1} mmHg" : "--"; public string DeltaPressureDisplay => HasChannelTelemetry("近端压力", "远端压力") ? $"{DeltaPressure:F1} mmHg" : "--";
public string ExportStateText => DetectionCompleted ? "检测已完成,可导出 PDF 正式报表" : "检测进行中,完成后导出 PDF 正式报表"; public string ExportStateText => DetectionCompleted ? "检测已完成,可导出检查报告" : "检测进行中,完成后导出检查报告";
public string SelectedItemTitle => SelectedItem?.Item ?? "未选择项目"; public string SelectedItemTitle => SelectedItem?.Item ?? "未选择项目";
public string SelectedItemStatusText => SelectedItem?.StatusText ?? "待检"; public string SelectedItemStatusText => SelectedItem?.StatusText ?? "待检";
public string RealtimeRecirculationDisplay => ChannelDisplay("再循环率", "F1", "%"); public string RealtimeRecirculationDisplay => ChannelDisplay("再循环率", "F1", "%");
@@ -804,7 +804,7 @@ public partial class MainViewModel : ObservableObject
AcquisitionRunning = false; AcquisitionRunning = false;
_timer.Stop(); _timer.Stop();
DeviceStatus = "采集停止"; DeviceStatus = "采集停止";
LatestAction = PendingCount == 0 ? "检测完成,全部项目已填写,可导出 PDF 报表。" : $"检测完成,但仍有 {PendingCount} 项待处理,请确认后导出 PDF 报表。"; LatestAction = PendingCount == 0 ? "检测完成,全部项目已填写,可导出检查报告。" : $"检测完成,但仍有 {PendingCount} 项待处理,请确认后导出检查报告。";
TraceEvents.Insert(0, NewTrace("检测完成", "检测员结束本次检测任务")); TraceEvents.Insert(0, NewTrace("检测完成", "检测员结束本次检测任务"));
} }
@@ -830,7 +830,7 @@ public partial class MainViewModel : ObservableObject
var outputDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); var outputDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
var timestamp = DateTime.Now.ToString("yyyyMMdd-HHmmss"); var timestamp = DateTime.Now.ToString("yyyyMMdd-HHmmss");
var batchToken = string.IsNullOrWhiteSpace(BatchNumber) ? "未填写批号" : BatchNumber.Trim(); var batchToken = string.IsNullOrWhiteSpace(BatchNumber) ? "未填写批号" : BatchNumber.Trim();
var pdfPath = Path.Combine(outputDirectory, $"检测报表-{batchToken}-{timestamp}.pdf"); var pdfPath = Path.Combine(outputDirectory, $"检查报告-{batchToken}-{timestamp}.pdf");
try try
{ {
@@ -862,13 +862,13 @@ public partial class MainViewModel : ObservableObject
recirculationLimitDisplay: RecirculationLimitDisplay); recirculationLimitDisplay: RecirculationLimitDisplay);
document.GeneratePdf(pdfPath); document.GeneratePdf(pdfPath);
LatestAction = $"已导出 PDF 正式报表: {pdfPath}"; LatestAction = $"已导出检查报告: {pdfPath}";
TraceEvents.Insert(0, NewTrace("报表导出", Path.GetFileName(pdfPath))); TraceEvents.Insert(0, NewTrace("检查报告导出", Path.GetFileName(pdfPath)));
} }
catch (Exception ex) catch (Exception ex)
{ {
LatestAction = $"PDF 导出失败: {ex.Message}"; LatestAction = $"检查报告导出失败: {ex.Message}";
TraceEvents.Insert(0, NewTrace("报表导出失败", ex.Message)); TraceEvents.Insert(0, NewTrace("检查报告导出失败", ex.Message));
} }
} }