Browse Source

新增检验报告管理模块

LT069288 4 months ago
parent
commit
fb63800e41

+ 2 - 0
UniformMaterialManagementSystem/App.xaml.cs

@@ -80,6 +80,8 @@ namespace UniformMaterialManagementSystem
             services.AddTransient<InspectionRecordPageViewModel>();
             services.AddTransient<ContractPageViewModel>();
             services.AddTransient<DeliveryReceiptViewModel>();
+            services.AddTransient<InspectionReportPageViewModel>();
+            services.AddTransient<SelectInspectApplyToReportWindowViewModel>();
 
             // Service 注册
             services.AddScoped(typeof(IDataBaseService<>), typeof(DataBaseService<>));

+ 1 - 1
UniformMaterialManagementSystem/Data/SqliteContext.cs

@@ -93,7 +93,7 @@ namespace UniformMaterialManagementSystem.Data
 
             modelBuilder.Entity<InspectionReportDetail>()
                 .HasOne(p => p.InspectionReport)
-                .WithMany(x => x.InspectReportDetails)
+                .WithMany(x => x.InspectionReportDetails)
                 .HasForeignKey(p => p.InspectionReportGuid);
 
         }

+ 1 - 1
UniformMaterialManagementSystem/Entities/InspectionReport.cs

@@ -40,7 +40,7 @@ namespace UniformMaterialManagementSystem.Entities
 
         public InspectApply InspectApply { get; set; } = null!;
 
-        public ObservableCollection<InspectionReportDetail> InspectReportDetails { get; set; } = null!;
+        public ObservableCollection<InspectionReportDetail> InspectionReportDetails { get; set; } = null!;
 
     }
 }

BIN
UniformMaterialManagementSystem/Template/军需物资质量监督检验报告模板.docx


+ 28 - 15
UniformMaterialManagementSystem/ViewModels/ContractPageViewModel.cs

@@ -1,20 +1,15 @@
 using CommunityToolkit.Mvvm.ComponentModel;
 using CommunityToolkit.Mvvm.Input;
-
 using Microsoft.EntityFrameworkCore;
 using Microsoft.Win32;
-
 using System.Collections.ObjectModel;
 using System.ComponentModel.DataAnnotations;
-using System.Data;
 using System.IO;
 using System.Text;
 using System.Windows;
-
 using UniformMaterialManagementSystem.Entities;
 using UniformMaterialManagementSystem.Services;
 using UniformMaterialManagementSystem.Utils;
-using UniformMaterialManagementSystem.Views;
 
 namespace UniformMaterialManagementSystem.ViewModels
 {
@@ -64,9 +59,6 @@ namespace UniformMaterialManagementSystem.ViewModels
         [ObservableProperty]
         private bool _isUpload;
 
-        //[ObservableProperty]
-        //private bool _isCompany;
-
         [ObservableProperty]
         private ObservableCollection<ContractDetail> _contractDetails = [];
 
@@ -143,11 +135,8 @@ namespace UniformMaterialManagementSystem.ViewModels
                 Materials.Add(material);
             }
 
-            //获取是否材料企业用户
-            //IsCompany = InspectApplyUtil.GetIsCompanyUser();
-
-            //默认材料企业
-            SelectedMaterialCompany = MaterialCompanies.FirstOrDefault(c => c.Guid == App.CurrentUser.CompanyGuid);
+            //默认材料企业或成品企业
+            SetDefaultCompany();
 
             //默认填报人
             EditUser = App.CurrentUser.UserName;
@@ -156,6 +145,27 @@ namespace UniformMaterialManagementSystem.ViewModels
 
         #region 合同录入相关方法
 
+        /// <summary>
+        /// 默认材料企业或成品企业
+        /// </summary>
+        private void SetDefaultCompany()
+        {
+            var currentRoleType = CommonUtil.GetRoleType();
+            if (currentRoleType == RoleType.MaterialCompany)
+            {
+                SelectedMaterialCompany = MaterialCompanies.FirstOrDefault(c => c.Guid == App.CurrentUser!.CompanyGuid);
+            }
+            else if (currentRoleType == RoleType.ProductCompany)
+            {
+                SelectedProductCompany = ProductCompanies.FirstOrDefault(c => c.Guid == App.CurrentUser!.CompanyGuid);
+            }
+            else
+            {
+                SelectedMaterialCompany = null;
+                SelectedProductCompany = null;
+            }
+        }
+
         /// <summary>
         /// 查询未导出合同
         /// </summary>
@@ -439,6 +449,9 @@ namespace UniformMaterialManagementSystem.ViewModels
 
                 /* 重新加载数据 */
                 LoadUnExportData();
+
+                /* 清空界面数据 */
+                ClearInput();
             }
         }
 
@@ -670,10 +683,10 @@ namespace UniformMaterialManagementSystem.ViewModels
         /// </summary>
         private void ClearInput()
         {
-            //SelectedProductCompany = null;
+            SetDefaultCompany();
             ContractNo = string.Empty;
             SigningDate = DateTime.Now;
-            //EditUser = string.Empty;
+            EditUser = App.CurrentUser!.UserName;
             EditDate = DateTime.Now;
             Telephone = string.Empty;
             Attachment = null;

+ 3 - 1
UniformMaterialManagementSystem/ViewModels/InspectApplyPageViewModel.cs

@@ -15,6 +15,7 @@ using UniformMaterialManagementSystem.Utils;
 using UniformMaterialManagementSystem.Views;
 using DocumentFormat.OpenXml.Wordprocessing;
 using InspectApplyContractDetail = UniformMaterialManagementSystem.Entities.InspectApplyContractDetail;
+using DocumentFormat.OpenXml.Spreadsheet;
 
 namespace UniformMaterialManagementSystem.ViewModels
 {
@@ -465,7 +466,8 @@ namespace UniformMaterialManagementSystem.ViewModels
             {
                 InspectApplyDetail applyDetail = new InspectApplyDetail();
                 applyDetail.PacketNo = dr["包号"].ToString();
-                applyDetail.Quantity = double.Parse(dr["数量"].ToString());
+                double quantity = double.Parse(dr["数量"].ToString());
+                applyDetail.Quantity = Math.Round(quantity, 2);
                 applyDetail.Note = dr["备注"].ToString();
                 InspectApplyDetails.Add(applyDetail);
             }

+ 148 - 0
UniformMaterialManagementSystem/ViewModels/InspectionReportPageViewModel.cs

@@ -0,0 +1,148 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using DocumentFormat.OpenXml.Bibliography;
+using Microsoft.EntityFrameworkCore;
+using UniformMaterialManagementSystem.Entities;
+using UniformMaterialManagementSystem.Services;
+using UniformMaterialManagementSystem.Views;
+
+namespace UniformMaterialManagementSystem.ViewModels
+{
+    public partial class InspectionReportPageViewModel : ObservableValidator
+    {
+
+        [ObservableProperty]
+        private ObservableCollection<InspectionReport> _inspectionReports = [];
+
+        [ObservableProperty]
+        private InspectionReport? _selectedInspectionReport;
+
+        [ObservableProperty]
+        private string? _purchaseCompanyNames;
+
+        [ObservableProperty]
+        private string? _contractNos;
+
+        private readonly IDataBaseService<InspectionReport> _inspectionReportService;
+
+        public InspectionReportPageViewModel(IDataBaseService<InspectionReport> inspectionReportService)
+        {
+            _inspectionReportService = inspectionReportService;
+
+            var inspectionReports = _inspectionReportService.Query()
+                .Include(x => x.InspectionReportDetails)
+                .Include(x => x.InspectApply)
+                .ThenInclude(x => x.Material)
+                .Include(x => x.InspectApply)
+                .ThenInclude(x => x.InspectApplyContractDetails)
+                .ToList();
+
+            foreach (var report in inspectionReports)
+            {
+                InspectionReports.Add(report);
+            }
+
+
+
+
+
+        }
+
+        /// <summary>
+        /// 选择行改变事件
+        /// </summary>
+        [RelayCommand]
+        private void InspectionReportSelectionChanged(InspectionReport inspectionReport)
+        {
+            SelectedInspectionReport = inspectionReport;
+
+            //获取合同信息
+            var dictionary = GetContractInformation(SelectedInspectionReport);
+            if (dictionary.ContainsKey("CompanyNames"))
+            {
+                PurchaseCompanyNames = dictionary["CompanyNames"];
+            }
+            if (dictionary.ContainsKey("ContractNos"))
+            {
+                ContractNos = dictionary["ContractNos"];
+            }
+        }
+
+        /// <summary>
+        /// 根据检验申请-合同信息拼接采购机构名称
+        /// </summary>
+        private Dictionary<string, string> GetContractInformation(InspectionReport? inspectionReport)
+        {
+            Dictionary<string, string> dictionary = new Dictionary<string, string>();
+            StringBuilder purchaseCompanyNames = new StringBuilder();
+            StringBuilder contractNos = new StringBuilder();
+            if (inspectionReport == null) return dictionary;
+            var contractDetails = inspectionReport.InspectApply.InspectApplyContractDetails;
+            foreach (var detail in contractDetails)
+            {
+                purchaseCompanyNames.Append(detail.PurchaseCompany).Append("\n");
+                contractNos.Append(detail.ContractNo).Append("\n");
+            }
+            dictionary.Add("CompanyNames", purchaseCompanyNames.ToString());
+            dictionary.Add("ContractNos", contractNos.ToString());
+
+            return dictionary;
+        }
+
+        /// <summary>
+        /// 新增检验报告
+        /// </summary>
+        [RelayCommand]
+        public void AddInspectionReport()
+        {
+            /* 打开窗口,展示检验报告状态未生成的检验申请列表,选择检验申请,携带检验申请数据 */
+            SelectInspectApplyToReportWindow inspectApplyWindow = new SelectInspectApplyToReportWindow();
+            var result = inspectApplyWindow.ShowDialog();
+            if (result == null || !(bool)result) return;
+
+            var inspectApply = inspectApplyWindow.DataGridMain.SelectedItem as InspectApply;
+            if (inspectApply == null) return;
+
+            //新增检验报告并设置默认值
+            InspectionReport inspectionReport = new InspectionReport
+            {
+                InspectApply = inspectApply,
+                ReportNo = inspectApply.ApplyNo.Replace("申请", ""),
+                Department = App.CurrentUser!.SupervisionUnit.Name,
+                ReportTime = DateTime.Now,
+                ReportBasis = "依据" + inspectApply.Material.NormName,
+                EditUser = App.CurrentUser!.UserName
+            };
+
+            InspectionReports.Add(inspectionReport);
+
+            //选中当前行
+            InspectionReportSelectionChanged(inspectionReport);
+        }
+
+        /// <summary>
+        /// 新增验收组
+        /// </summary>
+        [RelayCommand]
+        private void AddInspectionReportDetail()
+        {
+            if (SelectedInspectionReport == null) return;
+
+            SelectedInspectionReport.InspectionReportDetails ??= [];
+
+            InspectionReportDetail newDetail = new InspectionReportDetail
+            {
+                InspectionReportGuid = SelectedInspectionReport.Guid
+            };
+            SelectedInspectionReport.InspectionReportDetails.Add(newDetail);
+        }
+
+
+    }
+}

+ 49 - 0
UniformMaterialManagementSystem/ViewModels/SelectInspectApplyToReportWindowViewModel.cs

@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using Microsoft.EntityFrameworkCore;
+using UniformMaterialManagementSystem.Entities;
+using UniformMaterialManagementSystem.Services;
+
+namespace UniformMaterialManagementSystem.ViewModels
+{
+    public partial class SelectInspectApplyToReportWindowViewModel :ObservableObject
+    {
+        
+        [ObservableProperty] 
+        private ObservableCollection<InspectApply>  _inspectApplies = [];
+
+        private InspectApply? _selectedInspectApply;
+
+        private readonly IDataBaseService<InspectApply> _inspectApplyService;
+            
+        public SelectInspectApplyToReportWindowViewModel(IDataBaseService<InspectApply> inspectApplyService)
+        {
+            _inspectApplyService = inspectApplyService;
+
+            var inspectApplyList = _inspectApplyService.Query(x => !x.ReportStatus)
+                .Include(x=>x.InspectApplyContractDetails)
+                .Include(x=>x.Material).ToList();
+            foreach (var inspectApply in inspectApplyList)
+            {
+                InspectApplies.Add(inspectApply);
+            }
+        }
+
+        /// <summary>
+        /// 选择行改变事件
+        /// </summary>
+        [RelayCommand]
+        private void InspectApplySelectionChanged(InspectApply inspectApply)
+        {
+            _selectedInspectApply = inspectApply;
+        }
+
+    }
+}

+ 7 - 0
UniformMaterialManagementSystem/Views/ContractPage.xaml

@@ -879,6 +879,13 @@
                                                 IsColumnFiltered="True"
                                                 IsInteger="False"
                                                 StringFormat="{}{0:F2}" />
+
+                                            <!--<DataGridTextColumn
+                                                Width="150"
+                                                Binding="{Binding UnitPrice, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                                EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                                                ElementStyle="{StaticResource TextColumnElementStyle}"
+                                                Header="单价" />-->
                                         </control:FilterDataGrid.Columns>
                                     </control:FilterDataGrid>
 

+ 4 - 1
UniformMaterialManagementSystem/Views/InspectApplyPage.xaml

@@ -1053,10 +1053,13 @@
                                         x:Name="Quantity"
                                         Width="200"
                                         Binding="{Binding Quantity, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                        DecimalInputLimit="2"
                                         EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
                                         ElementStyle="{StaticResource TextColumnElementStyle}"
                                         Header="数量*"
-                                        IsColumnFiltered="True" />
+                                        IsColumnFiltered="True"
+                                        IsInteger="False"
+                                        StringFormat="{}{0:F2}" />
                                     <control:FilterDataGridTextColumn
                                         x:Name="Note"
                                         Width="200"

+ 533 - 66
UniformMaterialManagementSystem/Views/InspectionReportPage.xaml

@@ -30,9 +30,14 @@
             <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorTemplate}" />
         </Style>
         <Style TargetType="DatePicker">
+            <Setter Property="Height" Value="25" />
+            <Setter Property="FontSize" Value="14" />
             <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorTemplate}" />
         </Style>
         <Style TargetType="TextBox">
+            <Setter Property="Height" Value="25" />
+            <Setter Property="FontSize" Value="14" />
+            <Setter Property="VerticalContentAlignment" Value="Center" />
             <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorTemplate}" />
         </Style>
         <ControlTemplate x:Key="CustomColumnHeaderTemplate" TargetType="DataGridColumnHeader">
@@ -214,7 +219,7 @@
                 FilterLanguage="SimplifiedChinese"
                 HeadersVisibility="All"
                 HorizontalGridLinesBrush="LightSlateGray"
-                ItemsSource="{Binding InspectApplies, Mode=TwoWay}"
+                ItemsSource="{Binding InspectionReports, Mode=TwoWay}"
                 RowHeaderStyle="{StaticResource CustomRowHeaderStyle}"
                 RowStyle="{StaticResource CustomRowStyle}"
                 SelectionMode="Single"
@@ -225,7 +230,7 @@
                 <!--  选择行事件  -->
                 <b:Interaction.Triggers>
                     <b:EventTrigger EventName="SelectionChanged">
-                        <b:InvokeCommandAction Command="{Binding InspectApplySelectionChangedCommand}" CommandParameter="{Binding ElementName=DataGridMain, Path=SelectedItem}" />
+                        <b:InvokeCommandAction Command="{Binding InspectionReportSelectionChangedCommand}" CommandParameter="{Binding ElementName=DataGridMain, Path=SelectedItem}" />
                     </b:EventTrigger>
                 </b:Interaction.Triggers>
 
@@ -254,73 +259,44 @@
                 <control:FilterDataGrid.Columns>
                     <DataGridTextColumn
                         Width="60"
-                        Binding="{Binding Year}"
+                        Binding="{Binding InspectApply.Year}"
                         EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
                         ElementStyle="{StaticResource TextColumnElementStyle}"
                         Header="工作年度"
                         IsReadOnly="True" />
                     <control:FilterDataGridTextColumn
                         Width="300"
-                        Binding="{Binding ApplyNo}"
+                        Binding="{Binding ReportNo}"
                         EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
                         ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="检验申请表编号"
+                        Header="检验报告编号"
                         IsColumnFiltered="True"
                         IsReadOnly="True" />
                     <control:FilterDataGridTextColumn
                         Width="120"
-                        Binding="{Binding InspCategory}"
-                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                        ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="检验类别"
-                        IsColumnFiltered="True"
-                        IsReadOnly="True" />
-                    <control:FilterDataGridTextColumn
-                        Width="300"
-                        Binding="{Binding ProductName}"
+                        Binding="{Binding ReportTime}"
                         EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
                         ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="产品名称"
+                        Header="检验时间"
                         IsColumnFiltered="True"
                         IsReadOnly="True" />
                     <control:FilterDataGridTextColumn
-                        Width="200"
-                        Binding="{Binding Company}"
-                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                        ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="生产企业"
-                        IsColumnFiltered="True"
-                        IsReadOnly="True" />
-                    <control:FilterDataGridNumericColumn
-                        Width="150"
-                        Binding="{Binding InspQuantity}"
+                        Width="100"
+                        Binding="{Binding Conclusion}"
                         EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
                         ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="报检数量"
+                        Header="检验结论"
                         IsColumnFiltered="True"
                         IsReadOnly="True" />
                     <control:FilterDataGridTextColumn
-                        Width="150"
-                        Binding="{Binding InspDate, StringFormat=yyyy-MM-dd}"
+                        Width="100"
+                        Binding="{Binding EditUser}"
                         EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
                         ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="申请时间"
+                        Header="承办人"
                         IsColumnFiltered="True"
                         IsReadOnly="True" />
-                    <control:FilterDataGridTextColumn
-                        Width="150"
-                        Binding="{Binding ApplyUser}"
-                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                        ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="录入人"
-                        IsColumnFiltered="True"
-                        IsReadOnly="True" />
-                    <control:FilterDataGridCheckBoxColumn
-                        Width="130"
-                        Binding="{Binding ReportStatus}"
-                        ElementStyle="{StaticResource CheckBoxColumnElementStyle}"
-                        Header="检验报告生成状态"
-                        IsColumnFiltered="True" />
+
                 </control:FilterDataGrid.Columns>
             </filterDataGrid:FilterDataGrid>
         </Grid>
@@ -341,6 +317,30 @@
                 BorderThickness="1">
                 <ToolBarPanel>
                     <ToolBar Background="White" ToolBarTray.IsLocked="True">
+                        <Button Command="{Binding AddInspectionReportCommand}">
+                            <Button.Template>
+                                <ControlTemplate>
+                                    <Border
+                                        Width="40"
+                                        Background="{TemplateBinding Background}"
+                                        CornerRadius="5">
+                                        <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
+                                            <TextBlock
+                                                HorizontalAlignment="Center"
+                                                FontFamily="{StaticResource FluentSystemIconsRegular}"
+                                                FontSize="20"
+                                                Text="{x:Static utils:RegularFontUtil.Add_Circle_32}" />
+                                            <TextBlock Text="新增" />
+                                        </StackPanel>
+                                    </Border>
+                                    <ControlTemplate.Triggers>
+                                        <Trigger Property="IsMouseOver" Value="True">
+                                            <Setter Property="Background" Value="LightGray" />
+                                        </Trigger>
+                                    </ControlTemplate.Triggers>
+                                </ControlTemplate>
+                            </Button.Template>
+                        </Button>
                         <Button Command="{Binding SaveInspectApplyCommand}">
                             <Button.Template>
                                 <ControlTemplate>
@@ -353,7 +353,7 @@
                                                 HorizontalAlignment="Center"
                                                 FontFamily="{StaticResource FluentSystemIconsRegular}"
                                                 FontSize="20"
-                                                Text="{x:Static utils:RegularFontUtil.Save_Arrow_Right_20}" />
+                                                Text="{x:Static utils:RegularFontUtil.Save_32}" />
                                             <TextBlock Text="保存" />
                                         </StackPanel>
                                     </Border>
@@ -368,30 +368,497 @@
                     </ToolBar>
                 </ToolBarPanel>
             </Border>
-            <Grid Grid.Row="1" Background="White">
-                <Grid.RowDefinitions>
-                    <RowDefinition Height="50" />
-                    <RowDefinition Height="30" />
-                    <RowDefinition Height="30" />
-                    <RowDefinition Height="30" />
-                </Grid.RowDefinitions>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="*" />
-                    <ColumnDefinition Width="*" />
-                    <ColumnDefinition Width="*" />
-                    <ColumnDefinition Width="*" />
-                </Grid.ColumnDefinitions>
+            <ScrollViewer Grid.Row="1">
+                <Grid Grid.Row="1" Background="White">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="50" />
+                        <RowDefinition Height="35" />
+                        <RowDefinition Height="35" />
+                        <RowDefinition Height="35" />
+                        <RowDefinition Height="35" />
+                        <RowDefinition Height="35" />
+                        <RowDefinition Height="60" />
+                        <RowDefinition Height="35" />
+                        <RowDefinition Height="150" />
+                        <RowDefinition Height="170" />
+                        <RowDefinition Height="200" />
+                        <RowDefinition Height="35" />
+                    </Grid.RowDefinitions>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="2*" />
+                        <ColumnDefinition Width="2*" />
+                        <ColumnDefinition Width="2*" />
+                        <ColumnDefinition Width="2*" />
+                        <ColumnDefinition Width="*" />
+                    </Grid.ColumnDefinitions>
 
-                <TextBlock
-                    Grid.Row="0"
-                    Grid.Column="0"
-                    Grid.ColumnSpan="4"
-                    HorizontalAlignment="Center"
-                    VerticalAlignment="Center"
-                    FontSize="25"
-                    Text="军需物资质量监督检验报告" />
+                    <TextBlock
+                        Grid.Row="0"
+                        Grid.Column="0"
+                        Grid.ColumnSpan="5"
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center"
+                        FontSize="25"
+                        Text="军需物资质量监督检验报告" />
+                    <TextBlock
+                        Grid.Row="1"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        Text="检验报告编号:" />
+                    <TextBox
+                        Grid.Row="1"
+                        Grid.Column="1"
+                        IsReadOnly="True"
+                        Text="{Binding SelectedInspectionReport.ReportNo}" />
+                    <TextBlock
+                        Grid.Row="2"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        Text="*检验部门:" />
+                    <TextBox
+                        Grid.Row="2"
+                        Grid.Column="1"
+                        Text="{Binding SelectedInspectionReport.Department}" />
+                    <TextBlock
+                        Grid.Row="2"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        Text="*检验时间:" />
+                    <DatePicker
+                        Grid.Row="2"
+                        Grid.Column="3"
+                        Text="{Binding SelectedInspectionReport.ReportTime}" />
+                    <TextBlock
+                        Grid.Row="3"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        Text="检验类别:" />
+                    <StackPanel
+                        Grid.Row="3"
+                        Grid.Column="1"
+                        Grid.ColumnSpan="3"
+                        VerticalAlignment="Center">
+                        <Grid VerticalAlignment="Center" Background="White">
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="*" />
+                                <ColumnDefinition Width="*" />
+                                <ColumnDefinition Width="*" />
+                                <ColumnDefinition Width="*" />
+                            </Grid.ColumnDefinitions>
+                            <RadioButton
+                                x:Name="FirstRadioButton"
+                                Grid.Column="0"
+                                Content="报样检验"
+                                GroupName="InspectType"
+                                IsEnabled="False" />
+                            <RadioButton
+                                x:Name="SecondRadioButton"
+                                Grid.Column="1"
+                                Content="首批检验"
+                                GroupName="InspectType"
+                                IsEnabled="False" />
+                            <RadioButton
+                                x:Name="ThirdRadioButton"
+                                Grid.Column="2"
+                                Content="生产过程"
+                                GroupName="InspectType"
+                                IsEnabled="False" />
+                            <RadioButton
+                                x:Name="ForthRadioButton"
+                                Grid.Column="3"
+                                Content="出厂检验"
+                                GroupName="InspectType"
+                                IsEnabled="False" />
+                            <TextBox
+                                x:Name="InspectTypeText"
+                                Grid.Column="0"
+                                Text="{Binding SelectedInspectionReport.InspectApply.InspCategory, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                TextChanged="InspectTypeText_TextChanged"
+                                Visibility="Collapsed" />
+                        </Grid>
+                    </StackPanel>
+                    <TextBlock
+                        Grid.Row="4"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        Text="产品名称:" />
+                    <TextBlock
+                        Grid.Row="4"
+                        Grid.Column="1"
+                        Text="{Binding SelectedInspectionReport.InspectApply.Material.Name}" />
+                    <TextBlock
+                        Grid.Row="4"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        Text="生产企业:" />
+                    <TextBlock
+                        Grid.Row="4"
+                        Grid.Column="3"
+                        Text="{Binding SelectedInspectionReport.InspectApply.Company}" />
+                    <TextBlock
+                        Grid.Row="5"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        Text="产品数量:" />
+                    <Grid
+                        Grid.Row="5"
+                        Grid.Column="1"
+                        Background="White">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="Auto" />
+                            <ColumnDefinition Width="*" />
+                        </Grid.ColumnDefinitions>
+                        <TextBlock Grid.Column="0" Text="{Binding SelectedInspectionReport.InspectApply.InspQuantity}" />
+                        <TextBlock Grid.Column="1" Text="{Binding SelectedInspectionReport.InspectApply.Material.MeasureUnit}" />
+                    </Grid>
+                    <TextBlock
+                        Grid.Row="5"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        Text="生产日期:" />
+                    <Grid
+                        Grid.Row="5"
+                        Grid.Column="3"
+                        Background="White">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="Auto" />
+                            <ColumnDefinition Width="Auto" />
+                            <ColumnDefinition Width="*" />
+                        </Grid.ColumnDefinitions>
+                        <TextBlock Grid.Column="0" Text="{Binding SelectedInspectionReport.InspectApply.StartProductDate, StringFormat=yyyy年MM月}" />
+                        <TextBlock Grid.Column="1" Text="至" />
+                        <TextBlock Grid.Column="2" Text="{Binding SelectedInspectionReport.InspectApply.EndProductDate, StringFormat=yyyy年MM月}" />
+                    </Grid>
+                    <TextBlock
+                        Grid.Row="6"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        Text="采购机构:" />
+                    <TextBox
+                        Grid.Row="6"
+                        Grid.Column="1"
+                        Height="60"
+                        IsReadOnly="True"
+                        Text="{Binding PurchaseCompanyNames}"
+                        TextWrapping="Wrap"
+                        VerticalScrollBarVisibility="Auto" />
+                    <TextBlock
+                        Grid.Row="6"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        Text="合同编号:" />
+                    <TextBox
+                        Grid.Row="6"
+                        Grid.Column="3"
+                        Height="60"
+                        IsReadOnly="True"
+                        Text="{Binding ContractNos}"
+                        TextWrapping="Wrap"
+                        VerticalScrollBarVisibility="Auto" />
+                    <TextBlock
+                        Grid.Row="7"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        Text="*检验依据:" />
+                    <TextBox
+                        Grid.Row="7"
+                        Grid.Column="1"
+                        Grid.ColumnSpan="3"
+                        Text="{Binding SelectedInspectionReport.ReportBasis}" />
+                    <TextBlock
+                        Grid.Row="8"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*检验情况及主要问题:"
+                        TextWrapping="Wrap" />
+                    <Grid
+                        Grid.Row="8"
+                        Grid.Column="1"
+                        Grid.ColumnSpan="3"
+                        Background="White">
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="30" />
+                            <RowDefinition Height="*" />
+                        </Grid.RowDefinitions>
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="Auto" />
+                            <ColumnDefinition Width="Auto" />
+                            <ColumnDefinition Width="*" />
+                        </Grid.ColumnDefinitions>
+                        <RadioButton
+                            x:Name="IsSampleRadioButton"
+                            Grid.Row="0"
+                            Grid.Column="0"
+                            Padding="10,0,10,0"
+                            VerticalContentAlignment="Center"
+                            Content="抽样送检"
+                            Foreground="Red"
+                            GroupName="IsSampleGroup" />
+                        <RadioButton
+                            x:Name="NotSampleRadioButton"
+                            Grid.Row="0"
+                            Grid.Column="1"
+                            Padding="10,0,10,0"
+                            VerticalContentAlignment="Center"
+                            Content="未抽样送检"
+                            GroupName="IsSampleGroup" />
+                        <TextBox
+                            x:Name="IsSampleTextBox"
+                            Grid.Row="0"
+                            Grid.Column="2"
+                            Text="{Binding SelectedInspectionReport.IsSample}"
+                            TextChanged="IsSampleTextBox_TextChanged"
+                            Visibility="Collapsed" />
+                        <TextBox
+                            Grid.Row="1"
+                            Grid.Column="0"
+                            Grid.ColumnSpan="3"
+                            Height="120"
+                            HorizontalContentAlignment="Left"
+                            VerticalContentAlignment="Top"
+                            AcceptsReturn="True"
+                            Text="{Binding SelectedInspectionReport.ReportDesc}"
+                            TextWrapping="Wrap"
+                            VerticalScrollBarVisibility="Auto" />
+                    </Grid>
+                    <TextBlock
+                        Grid.Row="9"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        Text="*检验结论:" />
+                    <Grid
+                        Grid.Row="9"
+                        Grid.Column="1"
+                        Grid.ColumnSpan="3"
+                        Background="White">
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="30" />
+                            <RowDefinition Height="*" />
+                        </Grid.RowDefinitions>
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="Auto" />
+                            <ColumnDefinition Width="Auto" />
+                            <ColumnDefinition Width="*" />
+                        </Grid.ColumnDefinitions>
+                        <RadioButton
+                            x:Name="FirstQualifiedRadioButton"
+                            Grid.Row="0"
+                            Grid.Column="0"
+                            Padding="10,0,10,0"
+                            VerticalContentAlignment="Center"
+                            Content="合格"
+                            Foreground="Green"
+                            GroupName="ConclusionGroup" />
+                        <RadioButton
+                            x:Name="SecondQualifiedRadioButton"
+                            Grid.Row="0"
+                            Grid.Column="1"
+                            Padding="10,0,10,0"
+                            VerticalContentAlignment="Center"
+                            Content="合格(初测不合格,复测合格)"
+                            Foreground="DarkOrange"
+                            GroupName="ConclusionGroup" />
+                        <RadioButton
+                            x:Name="UnQualifiedRadioButton"
+                            Grid.Row="0"
+                            Grid.Column="2"
+                            Padding="10,0,10,0"
+                            VerticalContentAlignment="Center"
+                            Content="不合格"
+                            Foreground="Red"
+                            GroupName="ConclusionGroup" />
+                        <TextBox
+                            x:Name="ConclusionTextBox"
+                            Grid.Row="0"
+                            Grid.Column="2"
+                            Text="{Binding SelectedInspectionReport.Conclusion}"
+                            TextChanged="ConclusionTextBox_TextChanged"
+                            Visibility="Collapsed" />
+                        <TextBox
+                            Grid.Row="1"
+                            Grid.Column="0"
+                            Grid.ColumnSpan="3"
+                            Height="120"
+                            HorizontalContentAlignment="Left"
+                            VerticalContentAlignment="Top"
+                            AcceptsReturn="True"
+                            Text="{Binding SelectedInspectionReport.ConclusionDesc}"
+                            TextWrapping="Wrap"
+                            VerticalScrollBarVisibility="Auto" />
+                    </Grid>
+                    <TextBlock
+                        Grid.Row="10"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*验收组:" />
+                    <Grid
+                        Grid.Row="10"
+                        Grid.Column="1"
+                        Grid.ColumnSpan="3"
+                        Background="White">
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="Auto" />
+                            <RowDefinition Height="*" />
+                        </Grid.RowDefinitions>
+                        <!--  子菜单项  -->
+                        <Border
+                            Grid.Row="0"
+                            BorderBrush="Gray"
+                            BorderThickness="1">
+                            <ToolBarPanel>
+                                <ToolBar Background="White" ToolBarTray.IsLocked="True">
+                                    <Button HorizontalContentAlignment="Center" Command="{Binding AddInspectionReportDetailCommand}">
+                                        <Button.Template>
+                                            <ControlTemplate>
+                                                <Border
+                                                    Width="40"
+                                                    Background="{TemplateBinding Background}"
+                                                    CornerRadius="5">
+                                                    <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
+                                                        <TextBlock
+                                                            HorizontalAlignment="Center"
+                                                            FontFamily="{StaticResource FluentSystemIconsRegular}"
+                                                            FontSize="20"
+                                                            Text="{x:Static utils:RegularFontUtil.Add_Square_20}" />
+                                                        <TextBlock Text="新增" />
+                                                    </StackPanel>
+                                                </Border>
+                                                <ControlTemplate.Triggers>
+                                                    <Trigger Property="IsMouseOver" Value="True">
+                                                        <Setter Property="Background" Value="LightGray" />
+                                                    </Trigger>
+                                                </ControlTemplate.Triggers>
+                                            </ControlTemplate>
+                                        </Button.Template>
+                                    </Button>
+                                    <Button Command="{Binding}">
+                                        <Button.Template>
+                                            <ControlTemplate>
+                                                <Border
+                                                    Width="40"
+                                                    Background="{TemplateBinding Background}"
+                                                    CornerRadius="5">
+                                                    <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
+                                                        <TextBlock
+                                                            HorizontalAlignment="Center"
+                                                            FontFamily="{StaticResource FluentSystemIconsRegular}"
+                                                            FontSize="20"
+                                                            Text="{x:Static utils:RegularFontUtil.Dismiss_Square_20}" />
+                                                        <TextBlock Text="删除" />
+                                                    </StackPanel>
+                                                </Border>
+                                                <ControlTemplate.Triggers>
+                                                    <Trigger Property="IsMouseOver" Value="True">
+                                                        <Setter Property="Background" Value="LightGray" />
+                                                    </Trigger>
+                                                </ControlTemplate.Triggers>
+                                            </ControlTemplate>
+                                        </Button.Template>
+                                    </Button>
+                                </ToolBar>
+                            </ToolBarPanel>
+                        </Border>
+                        <DataGrid
+                            x:Name="DataGridDetail"
+                            Grid.Row="1"
+                            behaviors:DataGridBehavior.RowNumbers="True"
+                            AutoGenerateColumns="False"
+                            Background="White"
+                            CanUserAddRows="False"
+                            CanUserReorderColumns="True"
+                            CellStyle="{StaticResource CustomCellStyle}"
+                            ColumnHeaderStyle="{StaticResource CustomColumnHeaderStyle}"
+                            HeadersVisibility="All"
+                            HorizontalGridLinesBrush="LightSlateGray"
+                            ItemsSource="{Binding SelectedInspectionReport.InspectionReportDetails}"
+                            RowHeaderStyle="{StaticResource CustomRowHeaderStyle}"
+                            RowStyle="{StaticResource CustomRowStyle}"
+                            SelectionMode="Single"
+                            VerticalGridLinesBrush="LightSlateGray">
+                            <!--  选择行事件  -->
+                            <b:Interaction.Triggers>
+                                <b:EventTrigger EventName="SelectionChanged">
+                                    <b:InvokeCommandAction Command="{Binding}" CommandParameter="{Binding ElementName=DataDetail, Path=SelectedItem}" />
+                                </b:EventTrigger>
+                            </b:Interaction.Triggers>
 
-            </Grid>
+                            <DataGrid.Resources>
+                                <!--  非编辑模式下文本居中的样式  -->
+                                <Style x:Key="TextColumnElementStyle" TargetType="TextBlock">
+                                    <Setter Property="HorizontalAlignment" Value="Center" />
+                                    <Setter Property="VerticalAlignment" Value="Center" />
+                                    <Setter Property="TextAlignment" Value="Center" />
+                                </Style>
+
+                                <!--  编辑模式下文本居中的样式  -->
+                                <Style x:Key="TextColumnEditingElementStyle" TargetType="TextBox">
+                                    <Setter Property="HorizontalAlignment" Value="Stretch" />
+                                    <Setter Property="VerticalAlignment" Value="Stretch" />
+                                    <Setter Property="VerticalContentAlignment" Value="Center" />
+                                </Style>
+
+                                <Style x:Key="CheckBoxColumnElementStyle" TargetType="CheckBox">
+                                    <Setter Property="HorizontalAlignment" Value="Center" />
+                                    <Setter Property="VerticalAlignment" Value="Center" />
+                                    <Setter Property="IsEnabled" Value="False" />
+                                </Style>
+                            </DataGrid.Resources>
+                            <DataGrid.Columns>
+                                <!--<DataGridTemplateColumn Width="100" Header="检验组">
+                                    <DataGridTemplateColumn.CellTemplate>
+                                        <DataTemplate>
+                                            <TextBlock
+                                                HorizontalAlignment="Center"
+                                                VerticalAlignment="Center"
+                                                Text="{Binding JobCategory}" />
+                                        </DataTemplate>
+                                    </DataGridTemplateColumn.CellTemplate>
+                                    <DataGridTemplateColumn.CellEditingTemplate>
+                                        <DataTemplate>
+                                            <ComboBox
+                                                Height="25"
+                                                Background="White"
+                                                SelectedItem="{Binding JobCategory, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
+                                                <ComboBoxItem Content="组长" IsSelected="True" />
+                                                <ComboBoxItem Content="成员" />
+                                            </ComboBox>
+                                        </DataTemplate>
+                                    </DataGridTemplateColumn.CellEditingTemplate>
+                                </DataGridTemplateColumn>-->
+                                <DataGridTextColumn
+                                    Width="100"
+                                    Binding="{Binding JobCategory, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                                    ElementStyle="{StaticResource TextColumnElementStyle}"
+                                    Header="检验组" />
+                                <DataGridTextColumn
+                                    Width="300"
+                                    Binding="{Binding SupervisionUnit, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                                    ElementStyle="{StaticResource TextColumnElementStyle}"
+                                    Header="单位" />
+                                <DataGridTextColumn
+                                    Width="100"
+                                    Binding="{Binding Inspector, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                                    EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                                    ElementStyle="{StaticResource TextColumnElementStyle}"
+                                    Header="姓名" />
+                            </DataGrid.Columns>
+                        </DataGrid>
+                    </Grid>
+                    <TextBlock
+                        Grid.Row="11"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        Text="承办人:" />
+                    <TextBox
+                        Grid.Row="11"
+                        Grid.Column="1"
+                        Text="{Binding SelectedInspectionReport.EditUser}" />
+                </Grid>
+            </ScrollViewer>
 
 
         </Grid>

+ 59 - 13
UniformMaterialManagementSystem/Views/InspectionReportPage.xaml.cs

@@ -1,17 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
+using Microsoft.Extensions.DependencyInjection;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
+using UniformMaterialManagementSystem.ViewModels;
 
 namespace UniformMaterialManagementSystem.Views
 {
@@ -23,6 +12,63 @@ namespace UniformMaterialManagementSystem.Views
         public InspectionReportPage()
         {
             InitializeComponent();
+
+            this.DataContext = App.Current.Services.GetService<InspectionReportPageViewModel>();
+
+            //JobCategoryCombo.ItemsSource = new List<string>()
+            //{
+            //    "组长","成员"
+            //};
+        }
+
+        private void InspectTypeText_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            var inspectType = InspectTypeText.Text;
+            switch (inspectType)
+            {
+                case "报样检验":
+                    FirstRadioButton.IsChecked = true;
+                    break;
+                case "首批检验":
+                    SecondRadioButton.IsChecked = true;
+                    break;
+                case "过程检验":
+                    ThirdRadioButton.IsChecked = true;
+                    break;
+                case "出厂检验":
+                    ForthRadioButton.IsChecked = true;
+                    break;
+            }
+        }
+
+        private void IsSampleTextBox_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            var isSample = IsSampleTextBox.Text;
+            if (bool.Parse(isSample))
+            {
+                IsSampleRadioButton.IsChecked = true;
+            }
+            else
+            {
+                NotSampleRadioButton.IsChecked = true;
+            }
+        }
+
+        private void ConclusionTextBox_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            var conclusion = ConclusionTextBox.Text;
+            switch (conclusion)
+            {
+                case "合格":
+                    FirstQualifiedRadioButton.IsChecked = true;
+                    break;
+                case "合格(初测不合格,复测合格)":
+                    SecondQualifiedRadioButton.IsChecked = true;
+                    break;
+                case "不合格":
+                    UnQualifiedRadioButton.IsChecked = true;
+                    break;
+            }
         }
     }
 }

+ 294 - 0
UniformMaterialManagementSystem/Views/SelectInspectApplyToReportWindow.xaml

@@ -0,0 +1,294 @@
+<Window
+    x:Class="UniformMaterialManagementSystem.Views.SelectInspectApplyToReportWindow"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
+    xmlns:behaviors="clr-namespace:UniformMaterialManagementSystem.Behaviors"
+    xmlns:control="http://FilterDataGrid.Control.com/2024"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:filterDataGrid="http://FilterDataGrid.Control.com/2024"
+    xmlns:local="clr-namespace:UniformMaterialManagementSystem.Views"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:utils="clr-namespace:UniformMaterialManagementSystem.Utils"
+    Title="选择检验申请单生成检验报告"
+    Width="1000"
+    Height="600"
+    mc:Ignorable="d">
+    <Window.Resources>
+        <ControlTemplate x:Key="CustomColumnHeaderTemplate" TargetType="DataGridColumnHeader">
+            <Border BorderBrush="LightSlateGray" BorderThickness="0,0,1,1">
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition />
+                        <ColumnDefinition Width="Auto" />
+                        <ColumnDefinition Width="Auto" />
+                    </Grid.ColumnDefinitions>
+                    <Border
+                        Grid.Column="0"
+                        BorderBrush="#E9ECF1"
+                        BorderThickness="0,0,0,1">
+                        <ContentPresenter
+                            Margin="5,0"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center" />
+                    </Border>
+                    <Path
+                        x:Name="SortArrow"
+                        Grid.Column="1"
+                        Margin="0,0,5,0"
+                        VerticalAlignment="Center"
+                        Data="M 0 0 L 10 0 L 5 5 Z"
+                        Fill="Gray"
+                        Visibility="Collapsed" />
+                    <Thumb
+                        x:Name="PART_RightHeaderGripper"
+                        Grid.Column="2"
+                        Width="1"
+                        Height="25"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        BorderBrush="#E9ECF1"
+                        BorderThickness="1"
+                        Cursor="SizeWE" />
+                </Grid>
+            </Border>
+            <ControlTemplate.Triggers>
+                <Trigger Property="SortDirection" Value="Ascending">
+                    <Setter TargetName="SortArrow" Property="Data" Value="M 0 5 L 10 5 L 5 0 Z" />
+                    <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
+                </Trigger>
+                <Trigger Property="SortDirection" Value="Descending">
+                    <Setter TargetName="SortArrow" Property="Data" Value="M 0 0 L 10 0 L 5 5 Z" />
+                    <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
+                </Trigger>
+            </ControlTemplate.Triggers>
+        </ControlTemplate>
+
+        <Style x:Key="CustomColumnHeaderStyle" TargetType="DataGridColumnHeader">
+            <Setter Property="Background" Value="White" />
+            <Setter Property="Foreground" Value="Black" />
+            <Setter Property="FontWeight" Value="Bold" />
+            <Setter Property="HorizontalContentAlignment" Value="Center" />
+            <Setter Property="VerticalContentAlignment" Value="Center" />
+            <Setter Property="Height" Value="40" />
+            <Setter Property="Template" Value="{StaticResource CustomColumnHeaderTemplate}" />
+        </Style>
+
+        <Style x:Key="CustomRowHeaderStyle" TargetType="DataGridRowHeader">
+            <Setter Property="Background" Value="White" />
+            <Setter Property="Foreground" Value="Black" />
+            <Setter Property="BorderThickness" Value="0,0,1,1" />
+            <Setter Property="BorderBrush" Value="LightSlateGray" />
+        </Style>
+
+        <Style x:Key="CustomRowStyle" TargetType="DataGridRow">
+            <Setter Property="Background" Value="White" />
+            <Setter Property="FontSize" Value="13" />
+            <Setter Property="Height" Value="26" />
+
+            <Style.Triggers>
+                <Trigger Property="AlternationIndex" Value="1">
+                    <Setter Property="Background" Value="WhiteSmoke" />
+                </Trigger>
+                <Trigger Property="IsSelected" Value="True">
+                    <Setter Property="Background" Value="LightBlue" />
+                </Trigger>
+            </Style.Triggers>
+        </Style>
+        <Style
+            x:Key="CustomCellStyle"
+            BasedOn="{StaticResource {x:Type DataGridCell}}"
+            TargetType="DataGridCell">
+            <Setter Property="Background" Value="White" />
+            <Setter Property="HorizontalContentAlignment" Value="Center" />
+            <Setter Property="VerticalContentAlignment" Value="Center" />
+            <Setter Property="Padding" Value="10" />
+            <Style.Triggers>
+                <Trigger Property="IsSelected" Value="True">
+                    <Setter Property="Background" Value="LightBlue" />
+                    <Setter Property="Foreground" Value="Black" />
+                </Trigger>
+            </Style.Triggers>
+        </Style>
+    </Window.Resources>
+    <Grid Background="White">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto" />
+            <RowDefinition Height="*" />
+        </Grid.RowDefinitions>
+
+        <!--  菜单项  -->
+        <Border
+            Grid.Row="0"
+            BorderBrush="Gray"
+            BorderThickness="1">
+            <ToolBarPanel>
+                <ToolBar Background="White" ToolBarTray.IsLocked="True">
+                    <Button
+                        x:Name="ConfirmButton"
+                        HorizontalContentAlignment="Center"
+                        Click="ConfirmButton_Click">
+                        <Button.Template>
+                            <ControlTemplate>
+                                <Border
+                                    Width="70"
+                                    Background="{TemplateBinding Background}"
+                                    CornerRadius="5">
+                                    <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
+                                        <TextBlock
+                                            HorizontalAlignment="Center"
+                                            FontFamily="{StaticResource FluentSystemIconsRegular}"
+                                            FontSize="20"
+                                            Text="{x:Static utils:RegularFontUtil.Arrow_Sync_Checkmark_20}" />
+                                        <TextBlock Text="确认选择" />
+                                    </StackPanel>
+                                </Border>
+                                <ControlTemplate.Triggers>
+                                    <Trigger Property="IsMouseOver" Value="True">
+                                        <Setter Property="Background" Value="LightGray" />
+                                    </Trigger>
+                                </ControlTemplate.Triggers>
+                            </ControlTemplate>
+                        </Button.Template>
+                    </Button>
+                    <Button
+                        x:Name="CancelButton"
+                        HorizontalContentAlignment="Center"
+                        Click="CancelButton_Click">
+                        <Button.Template>
+                            <ControlTemplate>
+                                <Border
+                                    Width="40"
+                                    Background="{TemplateBinding Background}"
+                                    CornerRadius="5">
+                                    <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
+                                        <TextBlock
+                                            HorizontalAlignment="Center"
+                                            FontFamily="{StaticResource FluentSystemIconsRegular}"
+                                            FontSize="20"
+                                            Text="{x:Static utils:RegularFontUtil.Arrow_Sync_Dismiss_20}" />
+                                        <TextBlock Text="取消" />
+                                    </StackPanel>
+                                </Border>
+                                <ControlTemplate.Triggers>
+                                    <Trigger Property="IsMouseOver" Value="True">
+                                        <Setter Property="Background" Value="LightGray" />
+                                    </Trigger>
+                                </ControlTemplate.Triggers>
+                            </ControlTemplate>
+                        </Button.Template>
+                    </Button>
+
+                </ToolBar>
+            </ToolBarPanel>
+        </Border>
+
+        <!--  表格  -->
+        <filterDataGrid:FilterDataGrid
+            x:Name="DataGridMain"
+            Grid.Row="1"
+            behaviors:DataGridBehavior.RowNumbers="True"
+            AutoGenerateColumns="False"
+            Background="White"
+            CanUserAddRows="False"
+            CanUserReorderColumns="True"
+            CellStyle="{StaticResource CustomCellStyle}"
+            ColumnHeaderStyle="{StaticResource CustomColumnHeaderStyle}"
+            FilterLanguage="SimplifiedChinese"
+            HeadersVisibility="All"
+            HorizontalGridLinesBrush="LightSlateGray"
+            ItemsSource="{Binding InspectApplies, Mode=TwoWay}"
+            RowHeaderStyle="{StaticResource CustomRowHeaderStyle}"
+            RowStyle="{StaticResource CustomRowStyle}"
+            SelectionMode="Single"
+            ShowRowsCount="True"
+            ShowStatusBar="True"
+            VerticalGridLinesBrush="LightSlateGray">
+            <!--  选择行事件  -->
+            <b:Interaction.Triggers>
+                <b:EventTrigger EventName="SelectionChanged">
+                    <b:InvokeCommandAction Command="{Binding InspectApplySelectionChangedCommand}" CommandParameter="{Binding ElementName=DataGridMain, Path=SelectedItem}" />
+                </b:EventTrigger>
+            </b:Interaction.Triggers>
+            <control:FilterDataGrid.Resources>
+                <!--  非编辑模式下文本居中的样式  -->
+                <Style x:Key="TextColumnElementStyle" TargetType="TextBlock">
+                    <Setter Property="HorizontalAlignment" Value="Center" />
+                    <Setter Property="VerticalAlignment" Value="Center" />
+                    <Setter Property="TextAlignment" Value="Center" />
+                </Style>
+
+                <!--  编辑模式下文本居中的样式  -->
+                <Style x:Key="TextColumnEditingElementStyle" TargetType="TextBox">
+                    <Setter Property="HorizontalAlignment" Value="Stretch" />
+                    <Setter Property="VerticalAlignment" Value="Stretch" />
+                    <Setter Property="VerticalContentAlignment" Value="Center" />
+                </Style>
+
+                <Style x:Key="CheckBoxColumnElementStyle" TargetType="CheckBox">
+                    <Setter Property="HorizontalAlignment" Value="Center" />
+                    <Setter Property="VerticalAlignment" Value="Center" />
+                    <Setter Property="IsEnabled" Value="False" />
+                </Style>
+            </control:FilterDataGrid.Resources>
+            <control:FilterDataGrid.Columns>
+                <control:FilterDataGridTextColumn
+                    Width="300"
+                    Binding="{Binding ApplyNo, Mode=OneTime}"
+                    EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                    ElementStyle="{StaticResource TextColumnElementStyle}"
+                    Header="检验申请编号"
+                    IsColumnFiltered="True"
+                    IsReadOnly="True" />
+                <control:FilterDataGridTextColumn
+                    Width="100"
+                    Binding="{Binding InspCategory, Mode=OneTime}"
+                    EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                    ElementStyle="{StaticResource TextColumnElementStyle}"
+                    Header="检验类别"
+                    IsColumnFiltered="True"
+                    IsReadOnly="True" />
+                <control:FilterDataGridTextColumn
+                    Width="250"
+                    Binding="{Binding ProductName, Mode=OneTime}"
+                    EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                    ElementStyle="{StaticResource TextColumnElementStyle}"
+                    Header="产品名称"
+                    IsColumnFiltered="True"
+                    IsReadOnly="True" />
+                <control:FilterDataGridTextColumn
+                    Width="200"
+                    Binding="{Binding Company, Mode=OneTime}"
+                    EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                    ElementStyle="{StaticResource TextColumnElementStyle}"
+                    Header="生产企业"
+                    IsColumnFiltered="True"
+                    IsReadOnly="True" />
+                <control:FilterDataGridTextColumn
+                    Width="120"
+                    Binding="{Binding InspDate, Mode=OneTime}"
+                    EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                    ElementStyle="{StaticResource TextColumnElementStyle}"
+                    Header="申请检验时间"
+                    IsColumnFiltered="True"
+                    IsReadOnly="True" />
+                <control:FilterDataGridTextColumn
+                    Width="100"
+                    Binding="{Binding ApplyUser, Mode=OneTime}"
+                    EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                    ElementStyle="{StaticResource TextColumnElementStyle}"
+                    Header="申请人"
+                    IsColumnFiltered="True"
+                    IsReadOnly="True" />
+                <control:FilterDataGridCheckBoxColumn
+                    Width="150"
+                    Binding="{Binding ReportStatus, Mode=OneTime}"
+                    ElementStyle="{StaticResource CheckBoxColumnElementStyle}"
+                    Header="检验报告生成状态"
+                    IsColumnFiltered="True"
+                    IsReadOnly="True" />
+
+            </control:FilterDataGrid.Columns>
+        </filterDataGrid:FilterDataGrid>
+    </Grid>
+</Window>

+ 47 - 0
UniformMaterialManagementSystem/Views/SelectInspectApplyToReportWindow.xaml.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using UniformMaterialManagementSystem.Entities;
+using UniformMaterialManagementSystem.ViewModels;
+
+namespace UniformMaterialManagementSystem.Views
+{
+    /// <summary>
+    /// SelectInspectApplyToReportWindow.xaml 的交互逻辑
+    /// </summary>
+    public partial class SelectInspectApplyToReportWindow : Window
+    {
+        public SelectInspectApplyToReportWindow()
+        {
+            InitializeComponent();
+
+            this.DataContext = App.Current.Services.GetService(typeof(SelectInspectApplyToReportWindowViewModel));
+        }
+
+        private void ConfirmButton_Click(object sender, RoutedEventArgs e)
+        {
+            var inspectApply = DataGridMain.SelectedItem as InspectApply;
+            if (inspectApply == null)
+            {
+                MessageBox.Show("未选中任何行!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+                return;
+            }
+            this.DialogResult = true;
+        }
+
+        private void CancelButton_Click(object sender, RoutedEventArgs e)
+        {
+            this.DialogResult = false;
+        }
+    }
+}