Forráskód Böngészése

许可证录入开发

LT069288 3 hónapja
szülő
commit
8e633f4fdf
20 módosított fájl, 1817 hozzáadás és 743 törlés
  1. 5 1
      UniformMaterialManagementSystem/App.xaml.cs
  2. 1 0
      UniformMaterialManagementSystem/Models/FactoryLicenseModel.cs
  3. BIN
      UniformMaterialManagementSystem/Template/军需物资质量检验出厂许可证.docx
  4. BIN
      UniformMaterialManagementSystem/Template/军需物资质量检验出厂许可证_附表.docx
  5. 3 0
      UniformMaterialManagementSystem/UniformMaterialManagementSystem.csproj
  6. 68 0
      UniformMaterialManagementSystem/Utils/FactoryLicenseUtil.cs
  7. 247 0
      UniformMaterialManagementSystem/ViewModels/FactoryLicenseInputPageViewModel.cs
  8. 110 0
      UniformMaterialManagementSystem/ViewModels/FactoryLicenseManagePageViewModel.cs
  9. 0 93
      UniformMaterialManagementSystem/ViewModels/FactoryLicensePageViewModel.cs
  10. 16 0
      UniformMaterialManagementSystem/ViewModels/InspectionRecordPageViewModel.cs
  11. 16 0
      UniformMaterialManagementSystem/ViewModels/InspectionReportManagePageViewModel.cs
  12. 1 1
      UniformMaterialManagementSystem/ViewModels/SampleRegistrationPageViewModel.cs
  13. 600 0
      UniformMaterialManagementSystem/Views/FactoryLicense/FactoryLicenseInputPage.xaml
  14. 19 0
      UniformMaterialManagementSystem/Views/FactoryLicense/FactoryLicenseInputPage.xaml.cs
  15. 684 0
      UniformMaterialManagementSystem/Views/FactoryLicense/FactoryLicenseManagePage.xaml
  16. 19 0
      UniformMaterialManagementSystem/Views/FactoryLicense/FactoryLicenseManagePage.xaml.cs
  17. 9 623
      UniformMaterialManagementSystem/Views/FactoryLicensePage.xaml
  18. 13 4
      UniformMaterialManagementSystem/Views/FactoryLicensePage.xaml.cs
  19. 1 1
      UniformMaterialManagementSystem/Views/InspectionReport/InspectionReportManagePage.xaml
  20. 5 20
      UniformMaterialManagementSystem/Views/InspectionReport/InspectionReportManagePage.xaml.cs

+ 5 - 1
UniformMaterialManagementSystem/App.xaml.cs

@@ -9,6 +9,7 @@ using UniformMaterialManagementSystem.Models;
 using UniformMaterialManagementSystem.Services;
 using UniformMaterialManagementSystem.ViewModels;
 using UniformMaterialManagementSystem.Views;
+using UniformMaterialManagementSystem.Views.FactoryLicense;
 using UniformMaterialManagementSystem.Views.InspectionReport;
 using UniformMaterialManagementSystem.Views.LoginAndRegister;
 
@@ -77,6 +78,8 @@ namespace UniformMaterialManagementSystem
             services.AddKeyedTransient<UserControl, SelectApplyContractDialog>("SelectApplyContractDialog");
             services.AddKeyedTransient<UserControl, InspectionOrganizationPage>("InspectionOrganizationPage");
             services.AddKeyedTransient<UserControl, FactoryLicensePage>("FactoryLicensePage");
+            services.AddKeyedTransient<UserControl, FactoryLicenseInputPage>("FactoryLicenseInputPage");
+            services.AddKeyedTransient<UserControl, FactoryLicenseManagePage>("FactoryLicenseManagePage");
             services.AddKeyedTransient<UserControl, MaterialDeliveryPage>("MaterialDeliveryPage");
             services.AddKeyedTransient<UserControl, MaterialReceiptPage>("MaterialReceiptPage");
             services.AddKeyedTransient<UserControl, MaterialUsagePage>("MaterialUsagePage");
@@ -105,7 +108,8 @@ namespace UniformMaterialManagementSystem
             services.AddTransient<InspectionReportInputPageViewModel>();
             services.AddTransient<SampleRegistrationPageViewModel>();
             services.AddTransient<InspectionOrganizationPageViewModel>();
-            services.AddTransient<FactoryLicensePageViewModel>();
+            services.AddTransient<FactoryLicenseInputPageViewModel>();
+            services.AddTransient<FactoryLicenseManagePageViewModel>();
             services.AddTransient<SelectApplyContractDialogViewModel>();
             services.AddTransient<InspectionOrganizationPageViewModel>();
 

+ 1 - 0
UniformMaterialManagementSystem/Models/FactoryLicenseModel.cs

@@ -54,6 +54,7 @@ namespace UniformMaterialManagementSystem.Models
         public FactoryLicenseModel(FactoryLicense factoryLicense)
         {
             Guid = factoryLicense.Guid;
+            InspectApply = factoryLicense.InspectApply;
             InspectApplyGuid = factoryLicense.InspectApplyGuid;
             LicenseNo = factoryLicense.LicenseNo;
             LicenseListNo = factoryLicense.LicenseListNo;

BIN
UniformMaterialManagementSystem/Template/军需物资质量检验出厂许可证.docx


BIN
UniformMaterialManagementSystem/Template/军需物资质量检验出厂许可证_附表.docx


+ 3 - 0
UniformMaterialManagementSystem/UniformMaterialManagementSystem.csproj

@@ -99,6 +99,9 @@
 		<None Update="Template\军需物资质量检验出厂许可证.docx">
 		  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 		</None>
+		<None Update="Template\军需物资质量检验出厂许可证_附表.docx">
+		  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+		</None>
 		<None Update="Template\军需物资质量检验申请表模板.docx">
 			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
 		</None>

+ 68 - 0
UniformMaterialManagementSystem/Utils/FactoryLicenseUtil.cs

@@ -0,0 +1,68 @@
+using Microsoft.Win32;
+using System.IO;
+using System.Text;
+using System.Windows;
+using UniformMaterialManagementSystem.Models;
+
+namespace UniformMaterialManagementSystem.Utils
+{
+    public static class FactoryLicenseUtil
+    {
+        public static void ExportFactoryLicenseFile(FactoryLicenseModel factoryLicense)
+        {
+            const string templateFilePath = "Template\\军需物资质量检验出厂许可证.docx";
+            SaveFileDialog saveFileDialog = new SaveFileDialog()
+            {
+                Title = "请选择检验报告保存位置",
+                FileName = "军需物资质量检验出厂许可证-" + factoryLicense.LicenseNo + "-" + WordUtil.GenerateFileSerialNumber(),
+                Filter = "PDF文件格式 (*.pdf)|*.pdf",
+            };
+            if (saveFileDialog.ShowDialog() == false) return;
+            var destinationFile = saveFileDialog.FileName;
+
+            var dictionary = CreateDictionary(factoryLicense);
+            var tempFile = $"Template\\temp_{WordUtil.GenerateFileSerialNumber()}.docx";
+
+            WordUtil.GenerateWordByTemplate(templateFilePath, tempFile, dictionary);
+            WordUtil.SaveWordToPdf(tempFile, destinationFile);
+
+            //删除临时文件
+            File.Delete(tempFile);
+
+            MessageBox.Show("文档已生成!");
+        }
+
+        private static Dictionary<string, string> CreateDictionary(FactoryLicenseModel factoryLicense)
+        {
+            Dictionary<string, string> dictionary = new Dictionary<string, string>();
+            dictionary.Add("LicenseNo", factoryLicense.LicenseNo);
+            dictionary.Add("CompanyName", factoryLicense.InspectApply.Company);
+            StringBuilder sb = new StringBuilder();
+            foreach (var detail in factoryLicense.InspectApply.InspectApplyContractDetails)
+            {
+                sb.Append(detail.ContractNo).Append(',');
+            }
+            dictionary.Add("ContractNos", sb.ToString().Substring(0, sb.Length - 1));
+            dictionary.Add("LicenseListNo", factoryLicense.LicenseListNo);
+            dictionary.Add("MaterialName", factoryLicense.InspectApply.Material.Name);
+            dictionary.Add("ProductDate", factoryLicense.ProductDate ?? string.Empty);
+            dictionary.Add("Specification", factoryLicense.InspectApply.Material.Specification ?? "--");
+            dictionary.Add("FactoryDate", factoryLicense.FactoryDate.ToString("yyyy-MM-dd"));
+            dictionary.Add("FactoryQuantity", factoryLicense.FactoryQuantity + factoryLicense.InspectApply.Material.MeasureUnit);
+            dictionary.Add("Description", $"{factoryLicense.FactoryDate.ToString("yyyy年MM月dd日")},经我单位对该批出厂产品抽样检验,符合标准要求,准予出厂。内在质量检验结果见《检验报告》(编号{factoryLicense.InspectApply.InspReportNo})。产品出厂后,生产企业依法承担产品生产质量责任。");
+            dictionary.Add("Department", factoryLicense.Department);
+            dictionary.Add("SignDate", factoryLicense.SignDate.ToString("yyyy年MM月dd日"));
+            dictionary.Add("ReportNo", factoryLicense.InspectionReportNo ?? string.Empty);
+
+            return dictionary;
+        }
+
+        /// <summary>
+        /// 导出附表
+        /// </summary>
+        public static void ExportFactoryLicenseAttachedDoc(FactoryLicenseModel factoryLicense)
+        {
+
+        }
+    }
+}

+ 247 - 0
UniformMaterialManagementSystem/ViewModels/FactoryLicenseInputPageViewModel.cs

@@ -0,0 +1,247 @@
+using System.Collections.ObjectModel;
+using System.ComponentModel.DataAnnotations;
+using System.Printing;
+using System.Text;
+using System.Windows;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using Microsoft.EntityFrameworkCore;
+using UniformMaterialManagementSystem.Custom;
+using UniformMaterialManagementSystem.Entities;
+using UniformMaterialManagementSystem.Models;
+using UniformMaterialManagementSystem.Services;
+using UniformMaterialManagementSystem.Utils;
+
+namespace UniformMaterialManagementSystem.ViewModels
+{
+    public partial class FactoryLicenseInputPageViewModel : ObservableValidator
+    {
+        [ObservableProperty]
+        private string _licenseNo = string.Empty;
+
+        [ObservableProperty]
+        private string _licenseListNo = string.Empty;
+
+        [ObservableProperty]
+        private string _contractNos = string.Empty;
+
+        [ObservableProperty]
+        private string _productDate = string.Empty;
+
+        [ObservableProperty]
+        private string _inspectionReportNo = string.Empty;
+
+        [ObservableProperty]
+        private decimal _factoryQuantity;
+
+        [ObservableProperty]
+        private DateTime _factoryDate;
+
+        [ObservableProperty]
+        [Required(ErrorMessage = "发证单位不能为空")]
+        private string _department = string.Empty;
+
+        [ObservableProperty]
+        private DateTime _signDate;
+
+        [ObservableProperty]
+        [Required(ErrorMessage = "承办人不能为空")]
+        private string _editUser = string.Empty;
+
+        [ObservableProperty]
+        [Required(ErrorMessage = "批准人不能为空")]
+        private string _approveUser = string.Empty;
+
+        [ObservableProperty]
+        [Required(ErrorMessage = "审核人不能为空")]
+        private string _auditUser = string.Empty;
+
+        [ObservableProperty]
+        private InspectApply? _inspectApply;
+
+        [ObservableProperty]
+        private ObservableCollection<InspectApply> _inspectApplies = [];
+
+        private readonly IDataBaseService<InspectApply> _inspectApplyService;
+        private readonly IDataBaseService<InspectionReport> _inspectionReportService;
+        private readonly IDataBaseService<SampleRegistration> _sampleRegistrationService;
+        private readonly IDataBaseService<FactoryLicense> _factoryLicenseService;
+
+        private FactoryLicense? _factoryLicense;
+
+        public FactoryLicenseInputPageViewModel(IDataBaseService<InspectApply> inspectApplyService, IDataBaseService<InspectionReport> inspectionReportService, IDataBaseService<SampleRegistration> sampleRegistrationService, IDataBaseService<FactoryLicense> factoryLicenseService)
+        {
+            _inspectApplyService = inspectApplyService;
+            _inspectionReportService = inspectionReportService;
+            _sampleRegistrationService = sampleRegistrationService;
+            _factoryLicenseService = factoryLicenseService;
+
+            LoadData();
+        }
+
+
+        [RelayCommand]
+        private void LoadData()
+        {
+            var inspectApplyList = _inspectApplyService.QueryNoTracking(x => !x.LicenseStatus && x.ReportStatus)
+                .Include(x => x.InspectApplyContractDetails)
+                .Include(x => x.Material).ToList();
+
+            InspectApplies.Clear();
+            foreach (var inspectApply in inspectApplyList)
+            {
+                InspectApplies.Add(inspectApply);
+            }
+        }
+
+        /// <summary>
+        /// 保存
+        /// </summary>
+        [RelayCommand]
+        private void SaveFactoryLicence()
+        {
+            //校验是否选择检验申请单
+            if (InspectApply == null)
+            {
+                MessageEx.ShowWarningDialog("请双击检验申请表行数据进行新增,再执行保存!");
+                return;
+            }
+
+            //校验所有属性
+            ValidateAllProperties();
+            if (HasErrors) return;
+
+            //新增许可证
+            AddFactoryLicense();
+
+            //反写检验申请表的许可证状态
+            var inspect = _inspectApplyService.Get(x => x.Guid == InspectApply.Guid);
+            if (inspect != null)
+            {
+                inspect.LicenseStatus = true;
+            }
+
+            var result = _factoryLicenseService.SaveChanges();
+            if (result)
+            {
+                MessageEx.ShowInformation("保存成功!");
+            }
+
+            //重新加载检验申请列表
+            LoadData();
+
+            //导出文档
+            ExportFactoryLicence();
+
+            //清空界面
+            ClearInput();
+        }
+
+        private void ClearInput()
+        {
+            InspectApply = null;
+            LicenseNo = string.Empty;
+            LicenseListNo = string.Empty;
+            FactoryDate = DateTime.Now;
+            FactoryQuantity = 0;
+            Department = string.Empty;
+            SignDate = DateTime.Now;
+            EditUser = string.Empty;
+            ApproveUser = string.Empty;
+            AuditUser = string.Empty;
+            ProductDate = string.Empty;
+            ContractNos = string.Empty;
+        }
+
+        private void AddFactoryLicense()
+        {
+            if (InspectApply == null) return;
+            _factoryLicense = new FactoryLicense()
+            {
+                InspectApplyGuid = InspectApply.Guid,
+                LicenseNo = LicenseNo,
+                LicenseListNo = LicenseListNo,
+                FactoryDate = FactoryDate,
+                FactoryQuantity = FactoryQuantity,
+                Department = Department,
+                SignDate = SignDate,
+                EditUser = EditUser,
+                ApproveUser = ApproveUser,
+                AuditUser = AuditUser,
+            };
+
+            _factoryLicenseService.Insert(_factoryLicense);
+        }
+
+        [RelayCommand]
+        private void ExportFactoryLicence()
+        {
+            if (InspectApply == null || _factoryLicense == null) return;
+
+            _factoryLicense.InspectApply = InspectApply;
+            //导出许可证pdf文档
+            FactoryLicenseUtil.ExportFactoryLicenseFile(new FactoryLicenseModel(_factoryLicense));
+        }
+
+        /// <summary>
+        /// 鼠标双击事件
+        /// </summary>
+        [RelayCommand]
+        private void MouseDoubleClick(InspectApply inspectApply)
+        {
+            InspectApply = inspectApply;
+            if (InspectApply == null) return;
+
+            //许可证编号规则:申请表编号去掉出厂申请,替换为许
+            var replaceStr = inspectApply.ApplyNo.Substring(inspectApply.ApplyNo.IndexOf('材') + 1, 4);
+            LicenseNo = inspectApply.ApplyNo.Replace(replaceStr, "许");
+
+            StringBuilder sb = new StringBuilder();
+            foreach (var detail in inspectApply.InspectApplyContractDetails)
+            {
+                sb.AppendLine(detail.ContractNo);
+            }
+            ContractNos = sb.ToString();
+
+            ProductDate = inspectApply.StartProductDate.ToString("yyyy-MM-dd") + "至" +
+                          inspectApply.EndProductDate.ToString("yyyy-MM-dd");
+            InspectionReportNo = inspectApply.ApplyNo.Replace("申请", "");
+
+            //出厂数量:默认检验申请报检数量
+            FactoryQuantity = inspectApply.InspQuantity;
+
+            //出厂日期:默认检验报告日期
+            var report = _inspectionReportService.Get(x => x.InspectApplyGuid == inspectApply.Guid);
+            if (report != null)
+            {
+                FactoryDate = report.ReportTime;
+            }
+
+            //签发日期:根据是否抽样检测生成,如,是->抽样日期;否->检验报告日期
+            if (inspectApply.SampleStatus)
+            {
+                var sample = _sampleRegistrationService.Get(x => x.InspectApplyGuid == inspectApply.Guid);
+                if (sample != null)
+                {
+                    SignDate = sample.EditTime;
+                }
+            }
+            else
+            {
+                if (report != null)
+                {
+                    SignDate = report.ReportTime;
+                }
+            }
+
+            //清单号规则:签发日期8位+申请表流水号
+            LicenseListNo = SignDate.ToString("yyyyMMdd") +
+                            inspectApply.ApplyNo.Substring(inspectApply.ApplyNo.Length - 4, 3);
+
+            //发证单位
+            Department = "军需能源质量监督总站" + App.CurrentUser.SupervisionUnit.Name;
+            EditUser = App.CurrentUser.UserName;
+
+        }
+    }
+}

+ 110 - 0
UniformMaterialManagementSystem/ViewModels/FactoryLicenseManagePageViewModel.cs

@@ -0,0 +1,110 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using Microsoft.EntityFrameworkCore;
+using System.Collections.ObjectModel;
+using UniformMaterialManagementSystem.Entities;
+using UniformMaterialManagementSystem.Models;
+using UniformMaterialManagementSystem.Services;
+using UniformMaterialManagementSystem.Utils;
+
+namespace UniformMaterialManagementSystem.ViewModels
+{
+    public partial class FactoryLicenseManagePageViewModel :ObservableObject
+    {
+        [ObservableProperty]
+        private FactoryLicenseModel? _selectedFactoryLicense;
+
+        [ObservableProperty]
+        private ObservableCollection<FactoryLicenseModel> _factoryLicenses = [];
+
+        private readonly IDataBaseService<FactoryLicense> _licenceService;
+        private readonly IDataBaseService<InspectApply> _inspectApplyService;
+        private readonly IDataBaseService<InspectionReport> _reportService;
+        public FactoryLicenseManagePageViewModel(IDataBaseService<FactoryLicense> licenceService,IDataBaseService<InspectApply> inspectApplyService,IDataBaseService<InspectionReport> reportService)
+        {
+            _licenceService = licenceService;
+            _inspectApplyService = inspectApplyService;
+            _reportService = reportService;
+
+            LoadData();
+        }
+
+        /// <summary>
+        /// 刷新
+        /// </summary>
+        [RelayCommand]
+        private void LoadData()
+        {
+            var licenses = _licenceService.Query()
+                    .Include(x=>x.InspectApply)
+                    .ThenInclude(x=>x.InspectApplyContractDetails)
+                    .Include(x=>x.InspectApply)
+                    .ThenInclude(x=>x.Material);
+            foreach (var license in licenses)
+            {
+                FactoryLicenses.Add(new FactoryLicenseModel(license));
+            }
+        }
+
+        /// <summary>
+        /// 新增
+        /// </summary>
+        //[RelayCommand]
+        //private void AddFactoryLicence()
+        //{
+        //    /* 打开窗口,展示检验报告状态未生成的检验申请列表,选择检验申请,携带检验申请数据 */
+        //    SelectInspectApplyWindowViewModel viewModel =
+        //        new SelectInspectApplyWindowViewModel(_inspectApplyService, "FactoryLicense");
+        //    SelectInspectApplyWindow inspectApplyWindow = new SelectInspectApplyWindow(viewModel);
+
+        //    var result = inspectApplyWindow.ShowDialog();
+        //    if (result == null || !(bool)result) return;
+
+        //    var inspectApply = inspectApplyWindow.DataGridMain.SelectedItem as InspectApply;
+        //    if (inspectApply == null) return;
+
+        //    var inspectionReport = _reportService.Get(x => x.InspectApplyGuid == inspectApply.Guid);
+
+        //    FactoryLicense factoryLicense = new FactoryLicense()
+        //    {
+        //        InspectApplyGuid = inspectApply.Guid,
+        //        InspectApply = inspectApply,
+        //        LicenseNo = inspectApply.ApplyNo.Replace("申请","许"),
+        //        //LicenseListNo = ,
+        //        FactoryDate = inspectionReport?.ReportTime ?? DateTime.Now,
+
+        //    };
+        //}
+
+        /// <summary>
+        /// 导出许可证
+        /// </summary>
+        [RelayCommand]
+        private void ExportFactoryLicence()
+        {
+            if (SelectedFactoryLicense == null) return;
+            
+            FactoryLicenseUtil.ExportFactoryLicenseFile(SelectedFactoryLicense);
+        }
+
+        /// <summary>
+        /// 导出许可证附表
+        /// </summary>
+        [RelayCommand]
+        private void ExportFactoryLicenceAttachedDoc()
+        {
+            if (SelectedFactoryLicense == null) return;
+
+            FactoryLicenseUtil.ExportFactoryLicenseAttachedDoc(SelectedFactoryLicense);
+        }
+
+        /// <summary>
+        /// 删除许可证
+        /// </summary>
+        [RelayCommand]
+        private void RemoveFactoryLicense()
+        {
+
+        }
+    }
+}

+ 0 - 93
UniformMaterialManagementSystem/ViewModels/FactoryLicensePageViewModel.cs

@@ -1,93 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using CommunityToolkit.Mvvm.ComponentModel;
-using CommunityToolkit.Mvvm.Input;
-using Microsoft.EntityFrameworkCore;
-using UniformMaterialManagementSystem.Entities;
-using UniformMaterialManagementSystem.Models;
-using UniformMaterialManagementSystem.Services;
-using UniformMaterialManagementSystem.Views;
-
-namespace UniformMaterialManagementSystem.ViewModels
-{
-    public partial class FactoryLicensePageViewModel :ObservableObject
-    {
-        [ObservableProperty]
-        private FactoryLicenseModel? _selectedFactoryLicense;
-
-        [ObservableProperty]
-        private ObservableCollection<FactoryLicenseModel> _factoryLicenses = [];
-
-        private readonly IDataBaseService<FactoryLicense> _licenceService;
-        private readonly IDataBaseService<InspectApply> _inspectApplyService;
-        private readonly IDataBaseService<InspectionReport> _reportService;
-        public FactoryLicensePageViewModel(IDataBaseService<FactoryLicense> licenceService,IDataBaseService<InspectApply> inspectApplyService,IDataBaseService<InspectionReport> reportService)
-        {
-            _licenceService = licenceService;
-            _inspectApplyService = inspectApplyService;
-            _reportService = reportService;
-
-            LoadData();
-        }
-
-        private void LoadData()
-        {
-            var licenses = _licenceService.Query()
-                    .Include(x=>x.InspectApply)
-                    .ThenInclude(x=>x.InspectApplyContractDetails)
-                    .Include(x=>x.InspectApply)
-                    .ThenInclude(x=>x.Material);
-            foreach (var license in licenses)
-            {
-                FactoryLicenses.Add(new FactoryLicenseModel(license));
-            }
-        }
-
-        /// <summary>
-        /// 新增
-        /// </summary>
-        [RelayCommand]
-        private void AddFactoryLicence()
-        {
-            /* 打开窗口,展示检验报告状态未生成的检验申请列表,选择检验申请,携带检验申请数据 */
-            SelectInspectApplyWindowViewModel viewModel =
-                new SelectInspectApplyWindowViewModel(_inspectApplyService, "FactoryLicense");
-            SelectInspectApplyWindow inspectApplyWindow = new SelectInspectApplyWindow(viewModel);
-
-            var result = inspectApplyWindow.ShowDialog();
-            if (result == null || !(bool)result) return;
-
-            var inspectApply = inspectApplyWindow.DataGridMain.SelectedItem as InspectApply;
-            if (inspectApply == null) return;
-
-            var inspectionReport = _reportService.Get(x => x.InspectApplyGuid == inspectApply.Guid);
-
-            FactoryLicense factoryLicense = new FactoryLicense()
-            {
-                InspectApplyGuid = inspectApply.Guid,
-                InspectApply = inspectApply,
-                LicenseNo = inspectApply.ApplyNo.Replace("申请","许"),
-                //LicenseListNo = ,
-                FactoryDate = inspectionReport?.ReportTime ?? DateTime.Now,
-
-            };
-        }
-
-        [RelayCommand]
-        private void SaveFactoryLicence()
-        {
-
-        }
-
-        [RelayCommand]
-        private void ExportFactoryLicence()
-        {
-
-        }
-    }
-}

+ 16 - 0
UniformMaterialManagementSystem/ViewModels/InspectionRecordPageViewModel.cs

@@ -153,6 +153,22 @@ namespace UniformMaterialManagementSystem.ViewModels
                 return;
             }
 
+            if (InspectApply.ReportStatus)
+            {
+                MessageBox.Show("检验申请单已生成检验报告,不允许删除!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+                return;
+            }
+            if (InspectApply.SampleStatus)
+            {
+                MessageBox.Show("检验申请单已生成理化检测单,不允许删除!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+                return;
+            }
+            if (InspectApply.LicenseStatus)
+            {
+                MessageBox.Show("检验申请单已生成出厂许可证,不允许删除!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+                return;
+            }
+
             var result = MessageBox.Show($"确认删除:【{InspectApply.ApplyNo}】的全部信息? (非末次的原申请编号在删除后将不能在使用自动编号功能时启用,启用该编号需手动填写)", "删除提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
             if (result != MessageBoxResult.OK) { return; }
 

+ 16 - 0
UniformMaterialManagementSystem/ViewModels/InspectionReportManagePageViewModel.cs

@@ -1,5 +1,6 @@
 using CommunityToolkit.Mvvm.ComponentModel;
 using CommunityToolkit.Mvvm.Input;
+using DocumentFormat.OpenXml.Vml.Office;
 using Microsoft.EntityFrameworkCore;
 using System.Collections.ObjectModel;
 using System.Text;
@@ -55,6 +56,21 @@ namespace UniformMaterialManagementSystem.ViewModels
 
             /* 加载数据 */
             LoadData();
+
+        }
+
+        partial void OnSelectedInspectionReportChanging(InspectionReportModel? oldValue, InspectionReportModel? newValue)
+        {
+            if (oldValue == null) return;
+            bool isChanged = IsCurrentReportChanged(oldValue);
+            if (isChanged)
+            {
+                if (!AskIsSave())
+                {
+                    //取消变更新行
+                    SelectedInspectionReport = oldValue;
+                }
+            }
         }
 
         /// <summary>

+ 1 - 1
UniformMaterialManagementSystem/ViewModels/SampleRegistrationPageViewModel.cs

@@ -211,7 +211,7 @@ namespace UniformMaterialManagementSystem.ViewModels
             }
 
             //生成随机数
-            int random = RandomHelper.CreateRandom(organizations.Count);
+            int random = RandomHelper.CreateRandom(5);
             int count = random == 0 ? organizations.Count : random;
 
             //MessageBox.Show($"系统生成随机数为{random},将使用第{count}家检测机构。", "提示", MessageBoxButton.OK, MessageBoxImage.Information);

+ 600 - 0
UniformMaterialManagementSystem/Views/FactoryLicense/FactoryLicenseInputPage.xaml

@@ -0,0 +1,600 @@
+<UserControl
+    x:Class="UniformMaterialManagementSystem.Views.FactoryLicense.FactoryLicenseInputPage"
+    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:local="clr-namespace:UniformMaterialManagementSystem.Views.FactoryLicense"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:utils="clr-namespace:UniformMaterialManagementSystem.Utils"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    mc:Ignorable="d">
+    <UserControl.Resources>
+        <!--  定义一个全局的TextBlock样式  -->
+        <Style TargetType="TextBlock">
+            <Setter Property="FontSize" Value="14" />
+            <Setter Property="Margin" Value="5" />
+            <Setter Property="VerticalAlignment" Value="Center" />
+            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorTemplate}" />
+        </Style>
+        <Style TargetType="RadioButton">
+            <Setter Property="FontSize" Value="14" />
+            <Setter Property="VerticalAlignment" Value="Center" />
+        </Style>
+        <Style TargetType="ComboBox">
+            <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">
+            <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>
+
+    </UserControl.Resources>
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="*" />
+            <ColumnDefinition Width="Auto" />
+            <ColumnDefinition Width="2*" />
+        </Grid.ColumnDefinitions>
+        <Grid Grid.Column="0">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="Auto" />
+                <RowDefinition Height="*" />
+            </Grid.RowDefinitions>
+            <Grid Grid.Row="0">
+                <!--  菜单项  -->
+                <Border
+                    Grid.Row="0"
+                    BorderBrush="Gray"
+                    BorderThickness="1">
+                    <Grid Background="White">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="Auto" />
+                            <ColumnDefinition Width="*" />
+                        </Grid.ColumnDefinitions>
+                        <StackPanel
+                            Grid.Column="0"
+                            FlowDirection="LeftToRight"
+                            Orientation="Horizontal" />
+                        <ToolBarPanel Grid.Column="1">
+                            <ToolBar Background="White" ToolBarTray.IsLocked="True">
+
+                                <Button Command="{Binding LoadDataCommand}">
+                                    <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.Document_Search_16}" />
+                                                    <TextBlock Text="刷新" />
+                                                </StackPanel>
+                                            </Border>
+                                            <ControlTemplate.Triggers>
+                                                <Trigger Property="IsMouseOver" Value="True">
+                                                    <Setter Property="Background" Value="LightGray" />
+                                                </Trigger>
+                                            </ControlTemplate.Triggers>
+                                        </ControlTemplate>
+                                    </Button.Template>
+                                </Button>
+                                <Separator />
+
+                                <Button Command="{Binding SaveFactoryLicenceCommand}">
+                                    <Button.Template>
+                                        <ControlTemplate>
+                                            <Border
+                                                Width="100"
+                                                Background="{TemplateBinding Background}"
+                                                CornerRadius="5">
+                                                <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
+                                                    <TextBlock
+                                                        HorizontalAlignment="Center"
+                                                        FontFamily="{StaticResource FluentSystemIconsRegular}"
+                                                        FontSize="20"
+                                                        Text="{x:Static utils:RegularFontUtil.Save_Arrow_Right_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>
+                    </Grid>
+                </Border>
+            </Grid>
+            <control: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}"
+                RowHeaderStyle="{StaticResource CustomRowHeaderStyle}"
+                RowStyle="{StaticResource CustomRowStyle}"
+                SelectionMode="Single"
+                ShowRowsCount="True"
+                ShowStatusBar="True"
+                VerticalGridLinesBrush="LightSlateGray">
+
+                <!--  选择行事件  -->
+                <b:Interaction.Triggers>
+                    <b:EventTrigger EventName="MouseDoubleClick">
+                        <b:InvokeCommandAction Command="{Binding MouseDoubleClickCommand}" 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}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        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="200"
+                        Binding="{Binding ProductName}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="产品名称"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="200"
+                        Binding="{Binding Company}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="生产企业"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="200"
+                        Binding="{Binding BatchNo}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="材料批号"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="100"
+                        Binding="{Binding InspQuantity}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="报检数量"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="150"
+                        Binding="{Binding InspDate, StringFormat=yyyy-MM-dd}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="申请检验日期"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="100"
+                        Binding="{Binding ApplyUser}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="申请人"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+
+                </control:FilterDataGrid.Columns>
+            </control:FilterDataGrid>
+        </Grid>
+
+        <GridSplitter
+            Grid.Column="1"
+            Width="2"
+            HorizontalAlignment="Stretch" />
+        <Grid Grid.Column="2" Background="White">
+            <ScrollViewer>
+                <Grid Grid.Background="White">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="50" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                    </Grid.RowDefinitions>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="3*" />
+                        <ColumnDefinition Width="5*" />
+                        <ColumnDefinition Width="3*" />
+                        <ColumnDefinition Width="5*" />
+                        <ColumnDefinition Width="*" />
+                    </Grid.ColumnDefinitions>
+                    <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"
+                        VerticalAlignment="Center"
+                        Text="许可证编号:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="1"
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        Text="{Binding LicenseNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="1"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="清单号:" />
+                    <TextBlock
+                        Grid.Row="1"
+                        Grid.Column="3"
+                        VerticalAlignment="Center"
+                        Text="{Binding LicenseListNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="2"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="生产企业:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="2"
+                        Grid.Column="1"
+                        Text="{Binding InspectApply.Company}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="2"
+                        Grid.RowSpan="3"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="合同号:"
+                        TextWrapping="Wrap" />
+                    <TextBox
+                        Grid.Row="2"
+                        Grid.RowSpan="3"
+                        Grid.Column="3"
+                        Height="120"
+                        IsReadOnly="True"
+                        Text="{Binding ContractNos}"
+                        VerticalScrollBarVisibility="Auto" />
+
+                    <TextBlock
+                        Grid.Row="3"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="产品名称:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="3"
+                        Grid.Column="1"
+                        Text="{Binding InspectApply.Material.Name}"
+                        TextWrapping="Wrap" />
+
+                    <TextBlock
+                        Grid.Row="4"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="产品规格:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="4"
+                        Grid.Column="1"
+                        Text="{Binding InspectApply.Material.Specification}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="5"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="产品批号:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="5"
+                        Grid.Column="1"
+                        Text="{Binding InspectApply.BatchNo}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="5"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="生产日期:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="5"
+                        Grid.Column="3"
+                        Text="{Binding ProductDate}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="6"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="第三方检验报告编号:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="6"
+                        Grid.Column="1"
+                        Text="{Binding InspectApply.InspReportNo}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="6"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="检验报告编号:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="6"
+                        Grid.Column="3"
+                        Text="{Binding InspectionReportNo}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="7"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*出厂数量:"
+                        TextWrapping="Wrap" />
+                    <WrapPanel
+                        Grid.Row="7"
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        FlowDirection="LeftToRight">
+                        <TextBox
+                            Width="120"
+                            VerticalAlignment="Center"
+                            Text="{Binding FactoryQuantity, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                            TextWrapping="Wrap" />
+                        <TextBlock VerticalAlignment="Center" Text="{Binding InspectApply.Material.MeasureUnit}" />
+                    </WrapPanel>
+                    <TextBlock
+                        Grid.Row="7"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*出厂日期:"
+                        TextWrapping="Wrap" />
+                    <DatePicker
+                        Grid.Row="7"
+                        Grid.Column="3"
+                        Text="{Binding FactoryDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
+                    <TextBlock
+                        Grid.Row="8"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*发证单位:"
+                        TextWrapping="Wrap" />
+                    <TextBox
+                        Grid.Row="8"
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        Text="{Binding Department}" />
+                    <TextBlock
+                        Grid.Row="8"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*签发日期:"
+                        TextWrapping="Wrap" />
+                    <DatePicker
+                        Grid.Row="8"
+                        Grid.Column="3"
+                        VerticalAlignment="Center"
+                        Text="{Binding SignDate}" />
+                    <TextBlock
+                        Grid.Row="9"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*承办人:"
+                        TextWrapping="Wrap" />
+                    <TextBox
+                        Grid.Row="9"
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        Text="{Binding EditUser}" />
+                    <TextBlock
+                        Grid.Row="9"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*批准人:"
+                        TextWrapping="Wrap" />
+                    <TextBox
+                        Grid.Row="9"
+                        Grid.Column="3"
+                        VerticalAlignment="Center"
+                        Text="{Binding ApproveUser}" />
+                    <TextBlock
+                        Grid.Row="10"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*审核人:"
+                        TextWrapping="Wrap" />
+                    <TextBox
+                        Grid.Row="10"
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        Text="{Binding AuditUser}" />
+                </Grid>
+            </ScrollViewer>
+        </Grid>
+    </Grid>
+</UserControl>

+ 19 - 0
UniformMaterialManagementSystem/Views/FactoryLicense/FactoryLicenseInputPage.xaml.cs

@@ -0,0 +1,19 @@
+using Microsoft.Extensions.DependencyInjection;
+using System.Windows.Controls;
+using UniformMaterialManagementSystem.ViewModels;
+
+namespace UniformMaterialManagementSystem.Views.FactoryLicense
+{
+    /// <summary>
+    /// FactoryLicenseInputPage.xaml 的交互逻辑
+    /// </summary>
+    public partial class FactoryLicenseInputPage : UserControl
+    {
+        public FactoryLicenseInputPage()
+        {
+            InitializeComponent();
+
+            this.DataContext = App.Current.Services.GetServices<FactoryLicenseInputPageViewModel>();
+        }
+    }
+}

+ 684 - 0
UniformMaterialManagementSystem/Views/FactoryLicense/FactoryLicenseManagePage.xaml

@@ -0,0 +1,684 @@
+<UserControl
+    x:Class="UniformMaterialManagementSystem.Views.FactoryLicense.FactoryLicenseManagePage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:behaviors="clr-namespace:UniformMaterialManagementSystem.Behaviors"
+    xmlns:control="http://FilterDataGrid.Control.com/2024"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:UniformMaterialManagementSystem.Views"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:utils="clr-namespace:UniformMaterialManagementSystem.Utils"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    mc:Ignorable="d">
+    <UserControl.Resources>
+        <!--  定义一个全局的TextBlock样式  -->
+        <Style TargetType="TextBlock">
+            <Setter Property="FontSize" Value="14" />
+            <Setter Property="Margin" Value="5" />
+            <Setter Property="VerticalAlignment" Value="Center" />
+            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorTemplate}" />
+        </Style>
+        <Style TargetType="RadioButton">
+            <Setter Property="FontSize" Value="14" />
+            <Setter Property="VerticalAlignment" Value="Center" />
+        </Style>
+        <Style TargetType="ComboBox">
+            <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">
+            <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>
+
+    </UserControl.Resources>
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="*" />
+            <ColumnDefinition Width="Auto" />
+            <ColumnDefinition Width="2*" />
+        </Grid.ColumnDefinitions>
+        <Grid Grid.Column="0">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="Auto" />
+                <RowDefinition Height="*" />
+            </Grid.RowDefinitions>
+            <Grid Grid.Row="0">
+                <!--  菜单项  -->
+                <Border
+                    Grid.Row="0"
+                    BorderBrush="Gray"
+                    BorderThickness="1">
+                    <Grid Background="White">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="Auto" />
+                            <ColumnDefinition Width="*" />
+                        </Grid.ColumnDefinitions>
+                        <StackPanel
+                            Grid.Column="0"
+                            FlowDirection="LeftToRight"
+                            Orientation="Horizontal" />
+                        <ToolBarPanel Grid.Column="1">
+                            <ToolBar Background="White" ToolBarTray.IsLocked="True">
+
+                                <Button Command="{Binding LoadDataCommand}">
+                                    <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.Document_Search_16}" />
+                                                    <TextBlock Text="刷新" />
+                                                </StackPanel>
+                                            </Border>
+                                            <ControlTemplate.Triggers>
+                                                <Trigger Property="IsMouseOver" Value="True">
+                                                    <Setter Property="Background" Value="LightGray" />
+                                                </Trigger>
+                                            </ControlTemplate.Triggers>
+                                        </ControlTemplate>
+                                    </Button.Template>
+                                </Button>
+                                <Separator />
+                                <Button Command="{Binding RemoveFactoryLicenseCommand}">
+                                    <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.Delete_48}" />
+                                                    <TextBlock Text="删除许可证" />
+                                                </StackPanel>
+                                            </Border>
+                                            <ControlTemplate.Triggers>
+                                                <Trigger Property="IsMouseOver" Value="True">
+                                                    <Setter Property="Background" Value="LightGray" />
+                                                </Trigger>
+                                            </ControlTemplate.Triggers>
+                                        </ControlTemplate>
+                                    </Button.Template>
+                                </Button>
+                                <Separator />
+                                <!--<Button Command="{Binding AddFactoryLicenceCommand}">
+                                    <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 SaveFactoryLicenceCommand}">
+                                    <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.Save_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 ExportFactoryLicenceCommand}">
+                                    <Button.Template>
+                                        <ControlTemplate>
+                                            <Border
+                                                Width="60"
+                                                Background="{TemplateBinding Background}"
+                                                CornerRadius="5">
+                                                <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
+                                                    <TextBlock
+                                                        HorizontalAlignment="Center"
+                                                        FontFamily="{StaticResource FluentSystemIconsRegular}"
+                                                        FontSize="20"
+                                                        Text="{x:Static utils:RegularFontUtil.Dock_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 ExportFactoryLicenceAttachedDocCommand}">
+                                    <Button.Template>
+                                        <ControlTemplate>
+                                            <Border
+                                                Width="60"
+                                                Background="{TemplateBinding Background}"
+                                                CornerRadius="5">
+                                                <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
+                                                    <TextBlock
+                                                        HorizontalAlignment="Center"
+                                                        FontFamily="{StaticResource FluentSystemIconsRegular}"
+                                                        FontSize="20"
+                                                        Text="{x:Static utils:RegularFontUtil.Dock_20}" />
+                                                    <TextBlock Text="导出附表" />
+                                                </StackPanel>
+                                            </Border>
+                                            <ControlTemplate.Triggers>
+                                                <Trigger Property="IsMouseOver" Value="True">
+                                                    <Setter Property="Background" Value="LightGray" />
+                                                </Trigger>
+                                            </ControlTemplate.Triggers>
+                                        </ControlTemplate>
+                                    </Button.Template>
+                                </Button>
+                                <Separator />
+
+                            </ToolBar>
+                        </ToolBarPanel>
+                    </Grid>
+                </Border>
+            </Grid>
+            <control: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 FactoryLicenses, Mode=TwoWay}"
+                RowHeaderStyle="{StaticResource CustomRowHeaderStyle}"
+                RowStyle="{StaticResource CustomRowStyle}"
+                SelectedItem="{Binding SelectedFactoryLicense, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                SelectionMode="Single"
+                ShowRowsCount="True"
+                ShowStatusBar="True"
+                VerticalGridLinesBrush="LightSlateGray">
+
+                <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>
+                    <DataGridTextColumn
+                        Width="60"
+                        Binding="{Binding InspectApply.Year}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="工作年度"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="300"
+                        Binding="{Binding LicenseNo}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="出厂许可证编号"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="150"
+                        Binding="{Binding LicenseListNo}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="许可证清单号"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="200"
+                        Binding="{Binding InspectApply.Company}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="生产企业"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="120"
+                        Binding="{Binding FactoryDate, StringFormat=yyyy-MM-dd}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="出厂日期"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="120"
+                        Binding="{Binding FactoryQuantity}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="出厂数量"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+                    <control:FilterDataGridTextColumn
+                        Width="100"
+                        Binding="{Binding EditUser}"
+                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
+                        ElementStyle="{StaticResource TextColumnElementStyle}"
+                        Header="承办人"
+                        IsColumnFiltered="True"
+                        IsReadOnly="True" />
+
+                </control:FilterDataGrid.Columns>
+            </control:FilterDataGrid>
+        </Grid>
+
+        <GridSplitter
+            Grid.Column="1"
+            Width="2"
+            HorizontalAlignment="Stretch" />
+        <Grid Grid.Column="2" Background="White">
+            <ScrollViewer>
+                <Grid Grid.Background="White">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="50" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                        <RowDefinition Height="40" />
+                    </Grid.RowDefinitions>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="3*" />
+                        <ColumnDefinition Width="5*" />
+                        <ColumnDefinition Width="3*" />
+                        <ColumnDefinition Width="5*" />
+                        <ColumnDefinition Width="*" />
+                    </Grid.ColumnDefinitions>
+                    <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"
+                        VerticalAlignment="Center"
+                        Text="许可证编号:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="1"
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        Text="{Binding SelectedFactoryLicense.LicenseNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="1"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="清单号:" />
+                    <TextBlock
+                        Grid.Row="1"
+                        Grid.Column="3"
+                        VerticalAlignment="Center"
+                        Text="{Binding SelectedFactoryLicense.LicenseListNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="2"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="生产企业:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="2"
+                        Grid.Column="1"
+                        Text="{Binding SelectedFactoryLicense.InspectApply.Company}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="2"
+                        Grid.RowSpan="3"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="合同号:"
+                        TextWrapping="Wrap" />
+                    <TextBox
+                        Grid.Row="2"
+                        Grid.RowSpan="3"
+                        Grid.Column="3"
+                        Height="120"
+                        IsReadOnly="True"
+                        Text="{Binding SelectedFactoryLicense.ContractNos}"
+                        VerticalScrollBarVisibility="Auto" />
+
+                    <TextBlock
+                        Grid.Row="3"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="产品名称:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="3"
+                        Grid.Column="1"
+                        Text="{Binding SelectedFactoryLicense.InspectApply.Material.Name}"
+                        TextWrapping="Wrap" />
+
+                    <TextBlock
+                        Grid.Row="4"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="产品规格:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="4"
+                        Grid.Column="1"
+                        Text="{Binding SelectedFactoryLicense.InspectApply.Material.Specification}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="5"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="产品批号:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="5"
+                        Grid.Column="1"
+                        Text="{Binding SelectedFactoryLicense.InspectApply.BatchNo}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="5"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="生产日期:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="5"
+                        Grid.Column="3"
+                        Text="{Binding SelectedFactoryLicense.ProductDate}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="6"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="第三方检验报告编号:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="6"
+                        Grid.Column="1"
+                        Text="{Binding SelectedFactoryLicense.InspectApply.InspReportNo}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="6"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="检验报告编号:"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="6"
+                        Grid.Column="3"
+                        Text="{Binding SelectedFactoryLicense.InspectionReportNo}"
+                        TextWrapping="Wrap" />
+                    <TextBlock
+                        Grid.Row="7"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*出厂数量:"
+                        TextWrapping="Wrap" />
+                    <WrapPanel
+                        Grid.Row="7"
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        FlowDirection="LeftToRight">
+                        <TextBox
+                            Width="120"
+                            VerticalAlignment="Center"
+                            Text="{Binding SelectedFactoryLicense.FactoryQuantity, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                            TextWrapping="Wrap" />
+                        <TextBlock VerticalAlignment="Center" Text="{Binding SelectedFactoryLicense.InspectApply.Material.MeasureUnit}" />
+                    </WrapPanel>
+                    <TextBlock
+                        Grid.Row="7"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*出厂日期:"
+                        TextWrapping="Wrap" />
+                    <DatePicker
+                        Grid.Row="7"
+                        Grid.Column="3"
+                        Text="{Binding SelectedFactoryLicense.FactoryDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
+                    <TextBlock
+                        Grid.Row="8"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*发证单位:"
+                        TextWrapping="Wrap" />
+                    <TextBox
+                        Grid.Row="8"
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        Text="{Binding SelectedFactoryLicense.Department}" />
+                    <TextBlock
+                        Grid.Row="8"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*签发日期:"
+                        TextWrapping="Wrap" />
+                    <DatePicker
+                        Grid.Row="8"
+                        Grid.Column="3"
+                        VerticalAlignment="Center"
+                        Text="{Binding SelectedFactoryLicense.SignDate}" />
+                    <TextBlock
+                        Grid.Row="9"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*承办人:"
+                        TextWrapping="Wrap" />
+                    <TextBox
+                        Grid.Row="9"
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        Text="{Binding SelectedFactoryLicense.EditUser}" />
+                    <TextBlock
+                        Grid.Row="9"
+                        Grid.Column="2"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*批准人:"
+                        TextWrapping="Wrap" />
+                    <TextBox
+                        Grid.Row="9"
+                        Grid.Column="3"
+                        VerticalAlignment="Center"
+                        Text="{Binding SelectedFactoryLicense.ApproveUser}" />
+                    <TextBlock
+                        Grid.Row="10"
+                        Grid.Column="0"
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Text="*审核人:"
+                        TextWrapping="Wrap" />
+                    <TextBox
+                        Grid.Row="10"
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        Text="{Binding SelectedFactoryLicense.AuditUser}" />
+
+
+
+                </Grid>
+            </ScrollViewer>
+        </Grid>
+    </Grid>
+</UserControl>

+ 19 - 0
UniformMaterialManagementSystem/Views/FactoryLicense/FactoryLicenseManagePage.xaml.cs

@@ -0,0 +1,19 @@
+using Microsoft.Extensions.DependencyInjection;
+using System.Windows.Controls;
+using UniformMaterialManagementSystem.ViewModels;
+
+namespace UniformMaterialManagementSystem.Views.FactoryLicense
+{
+    /// <summary>
+    /// FactoryLicensePage.xaml 的交互逻辑
+    /// </summary>
+    public partial class FactoryLicenseManagePage : UserControl
+    {
+        public FactoryLicenseManagePage()
+        {
+            InitializeComponent();
+
+            this.DataContext = App.Current.Services.GetServices<FactoryLicenseManagePageViewModel>();
+        }
+    }
+}

+ 9 - 623
UniformMaterialManagementSystem/Views/FactoryLicensePage.xaml

@@ -2,634 +2,20 @@
     x:Class="UniformMaterialManagementSystem.Views.FactoryLicensePage"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    xmlns:behaviors="clr-namespace:UniformMaterialManagementSystem.Behaviors"
-    xmlns:control="http://FilterDataGrid.Control.com/2024"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-    xmlns:local="clr-namespace:UniformMaterialManagementSystem.Views"
+    xmlns:license="clr-namespace:UniformMaterialManagementSystem.Views.FactoryLicense"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-    xmlns:utils="clr-namespace:UniformMaterialManagementSystem.Utils"
     d:DesignHeight="450"
     d:DesignWidth="800"
     mc:Ignorable="d">
-    <UserControl.Resources>
-        <!--  定义一个全局的TextBlock样式  -->
-        <Style TargetType="TextBlock">
-            <Setter Property="FontSize" Value="14" />
-            <Setter Property="Margin" Value="5" />
-            <Setter Property="VerticalAlignment" Value="Center" />
-            <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ValidationErrorTemplate}" />
-        </Style>
-        <Style TargetType="RadioButton">
-            <Setter Property="FontSize" Value="14" />
-            <Setter Property="VerticalAlignment" Value="Center" />
-        </Style>
-        <Style TargetType="ComboBox">
-            <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">
-            <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>
-
-    </UserControl.Resources>
     <Grid>
-        <Grid.ColumnDefinitions>
-            <ColumnDefinition Width="*" />
-            <ColumnDefinition Width="Auto" />
-            <ColumnDefinition Width="2*" />
-        </Grid.ColumnDefinitions>
-        <Grid Grid.Column="0">
-            <Grid.RowDefinitions>
-                <RowDefinition Height="Auto" />
-                <RowDefinition Height="*" />
-            </Grid.RowDefinitions>
-            <Grid Grid.Row="0">
-                <!--  菜单项  -->
-                <Border
-                    Grid.Row="0"
-                    BorderBrush="Gray"
-                    BorderThickness="1">
-                    <Grid Background="White">
-                        <Grid.ColumnDefinitions>
-                            <ColumnDefinition Width="Auto" />
-                            <ColumnDefinition Width="*" />
-                        </Grid.ColumnDefinitions>
-                        <StackPanel
-                            Grid.Column="0"
-                            FlowDirection="LeftToRight"
-                            Orientation="Horizontal" />
-                        <ToolBarPanel Grid.Column="1">
-                            <ToolBar Background="White" ToolBarTray.IsLocked="True">
-
-                                <Button Command="{Binding LoadDataCommand}">
-                                    <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.Document_Search_16}" />
-                                                    <TextBlock Text="刷新" />
-                                                </StackPanel>
-                                            </Border>
-                                            <ControlTemplate.Triggers>
-                                                <Trigger Property="IsMouseOver" Value="True">
-                                                    <Setter Property="Background" Value="LightGray" />
-                                                </Trigger>
-                                            </ControlTemplate.Triggers>
-                                        </ControlTemplate>
-                                    </Button.Template>
-                                </Button>
-                                <Separator />
-                                <Button Command="{Binding AddFactoryLicenceCommand}">
-                                    <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 SaveFactoryLicenceCommand}">
-                                    <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.Save_32}" />
-                                                    <TextBlock Text="保存" />
-                                                </StackPanel>
-                                            </Border>
-                                            <ControlTemplate.Triggers>
-                                                <Trigger Property="IsMouseOver" Value="True">
-                                                    <Setter Property="Background" Value="LightGray" />
-                                                </Trigger>
-                                            </ControlTemplate.Triggers>
-                                        </ControlTemplate>
-                                    </Button.Template>
-                                </Button>
-                                <Separator />
-                                <Button Command="{Binding ExportFactoryLicenceCommand}">
-                                    <Button.Template>
-                                        <ControlTemplate>
-                                            <Border
-                                                Width="60"
-                                                Background="{TemplateBinding Background}"
-                                                CornerRadius="5">
-                                                <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
-                                                    <TextBlock
-                                                        HorizontalAlignment="Center"
-                                                        FontFamily="{StaticResource FluentSystemIconsRegular}"
-                                                        FontSize="20"
-                                                        Text="{x:Static utils:RegularFontUtil.Dock_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>
-                    </Grid>
-                </Border>
-            </Grid>
-            <control: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 FactoryLicenses, Mode=TwoWay}"
-                RowHeaderStyle="{StaticResource CustomRowHeaderStyle}"
-                RowStyle="{StaticResource CustomRowStyle}"
-                SelectedItem="{Binding SelectedFactoryLicense, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
-                SelectionMode="Single"
-                ShowRowsCount="True"
-                ShowStatusBar="True"
-                VerticalGridLinesBrush="LightSlateGray">
-
-                <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>
-                    <DataGridTextColumn
-                        Width="60"
-                        Binding="{Binding InspectApply.Year}"
-                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                        ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="工作年度"
-                        IsReadOnly="True" />
-                    <control:FilterDataGridTextColumn
-                        Width="300"
-                        Binding="{Binding LicenseNo}"
-                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                        ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="出厂许可证编号"
-                        IsColumnFiltered="True"
-                        IsReadOnly="True" />
-                    <control:FilterDataGridTextColumn
-                        Width="150"
-                        Binding="{Binding LicenseListNo}"
-                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                        ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="许可证清单号"
-                        IsColumnFiltered="True"
-                        IsReadOnly="True" />
-                    <control:FilterDataGridTextColumn
-                        Width="200"
-                        Binding="{Binding InspectApply.Company}"
-                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                        ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="生产企业"
-                        IsColumnFiltered="True"
-                        IsReadOnly="True" />
-                    <control:FilterDataGridTextColumn
-                        Width="120"
-                        Binding="{Binding FactoryDate, StringFormat=yyyy-MM-dd}"
-                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                        ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="出厂日期"
-                        IsColumnFiltered="True"
-                        IsReadOnly="True" />
-                    <control:FilterDataGridTextColumn
-                        Width="120"
-                        Binding="{Binding FactoryQuantity}"
-                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                        ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="出厂数量"
-                        IsColumnFiltered="True"
-                        IsReadOnly="True" />
-                    <control:FilterDataGridTextColumn
-                        Width="100"
-                        Binding="{Binding EditUser}"
-                        EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                        ElementStyle="{StaticResource TextColumnElementStyle}"
-                        Header="承办人"
-                        IsColumnFiltered="True"
-                        IsReadOnly="True" />
-
-                </control:FilterDataGrid.Columns>
-            </control:FilterDataGrid>
-        </Grid>
-
-        <GridSplitter
-            Grid.Column="1"
-            Width="2"
-            HorizontalAlignment="Stretch" />
-        <Grid Grid.Column="2" Background="White">
-            <ScrollViewer>
-                <Grid Grid.Background="White">
-                    <Grid.RowDefinitions>
-                        <RowDefinition Height="50" />
-                        <RowDefinition Height="40" />
-                        <RowDefinition Height="40" />
-                        <RowDefinition Height="40" />
-                        <RowDefinition Height="40" />
-                        <RowDefinition Height="40" />
-                        <RowDefinition Height="40" />
-                        <RowDefinition Height="40" />
-                        <RowDefinition Height="40" />
-                        <RowDefinition Height="40" />
-                        <RowDefinition Height="40" />
-                        <RowDefinition Height="40" />
-                    </Grid.RowDefinitions>
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="3*" />
-                        <ColumnDefinition Width="5*" />
-                        <ColumnDefinition Width="3*" />
-                        <ColumnDefinition Width="5*" />
-                        <ColumnDefinition Width="*" />
-                    </Grid.ColumnDefinitions>
-                    <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"
-                        VerticalAlignment="Center"
-                        Text="许可证编号:"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="1"
-                        Grid.Column="1"
-                        VerticalAlignment="Center"
-                        Text="{Binding SelectedFactoryLicense.LicenseNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="1"
-                        Grid.Column="2"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="清单号:" />
-                    <TextBlock
-                        Grid.Row="1"
-                        Grid.Column="3"
-                        VerticalAlignment="Center"
-                        Text="{Binding SelectedFactoryLicense.LicenseListNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="2"
-                        Grid.Column="0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="生产企业:"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="2"
-                        Grid.Column="1"
-                        Text="{Binding SelectedFactoryLicense.InspectApply.Company}"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="2"
-                        Grid.RowSpan="3"
-                        Grid.Column="2"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="合同号:"
-                        TextWrapping="Wrap" />
-                    <TextBox
-                        Grid.Row="2"
-                        Grid.RowSpan="3"
-                        Grid.Column="3"
-                        Height="120"
-                        IsReadOnly="True"
-                        Text="{Binding SelectedFactoryLicense.ContractNos}"
-                        VerticalScrollBarVisibility="Auto" />
-
-                    <TextBlock
-                        Grid.Row="3"
-                        Grid.Column="0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="产品名称:"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="3"
-                        Grid.Column="1"
-                        Text="{Binding SelectedFactoryLicense.InspectApply.Material.Name}"
-                        TextWrapping="Wrap" />
-
-                    <TextBlock
-                        Grid.Row="4"
-                        Grid.Column="0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="产品规格:"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="4"
-                        Grid.Column="1"
-                        Text="{Binding SelectedFactoryLicense.InspectApply.Material.Specification}"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="5"
-                        Grid.Column="0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="产品批号:"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="5"
-                        Grid.Column="1"
-                        Text="{Binding SelectedFactoryLicense.InspectApply.BatchNo}"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="5"
-                        Grid.Column="2"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="生产日期:"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="5"
-                        Grid.Column="3"
-                        Text="{Binding SelectedFactoryLicense.ProductDate}"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="6"
-                        Grid.Column="0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="第三方检验报告编号:"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="6"
-                        Grid.Column="1"
-                        Text="{Binding SelectedFactoryLicense.InspectApply.InspReportNo}"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="6"
-                        Grid.Column="2"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="检验报告编号:"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="6"
-                        Grid.Column="3"
-                        Text="{Binding SelectedFactoryLicense.InspectionReportNo}"
-                        TextWrapping="Wrap" />
-                    <TextBlock
-                        Grid.Row="7"
-                        Grid.Column="0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="*出厂数量:"
-                        TextWrapping="Wrap" />
-                    <WrapPanel
-                        Grid.Row="7"
-                        Grid.Column="1"
-                        VerticalAlignment="Center"
-                        FlowDirection="LeftToRight">
-                        <TextBox
-                            Width="120"
-                            VerticalAlignment="Center"
-                            Text="{Binding SelectedFactoryLicense.FactoryQuantity, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
-                            TextWrapping="Wrap" />
-                        <TextBlock VerticalAlignment="Center" Text="{Binding SelectedFactoryLicense.InspectApply.Material.MeasureUnit}" />
-                    </WrapPanel>
-                    <TextBlock
-                        Grid.Row="7"
-                        Grid.Column="2"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="*出厂日期:"
-                        TextWrapping="Wrap" />
-                    <DatePicker
-                        Grid.Row="7"
-                        Grid.Column="3"
-                        Text="{Binding SelectedFactoryLicense.FactoryDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
-                    <TextBlock
-                        Grid.Row="8"
-                        Grid.Column="0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="*发证单位:"
-                        TextWrapping="Wrap" />
-                    <TextBox
-                        Grid.Row="8"
-                        Grid.Column="1"
-                        VerticalAlignment="Center"
-                        Text="{Binding SelectedFactoryLicense.Department}" />
-                    <TextBlock
-                        Grid.Row="8"
-                        Grid.Column="2"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="*签发日期:"
-                        TextWrapping="Wrap" />
-                    <DatePicker
-                        Grid.Row="8"
-                        Grid.Column="3"
-                        VerticalAlignment="Center"
-                        Text="{Binding SelectedFactoryLicense.SignDate}" />
-                    <TextBlock
-                        Grid.Row="9"
-                        Grid.Column="0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="*承办人:"
-                        TextWrapping="Wrap" />
-                    <TextBox
-                        Grid.Row="9"
-                        Grid.Column="1"
-                        VerticalAlignment="Center"
-                        Text="{Binding SelectedFactoryLicense.EditUser}" />
-                    <TextBlock
-                        Grid.Row="9"
-                        Grid.Column="2"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="*批准人:"
-                        TextWrapping="Wrap" />
-                    <TextBox
-                        Grid.Row="9"
-                        Grid.Column="3"
-                        VerticalAlignment="Center"
-                        Text="{Binding SelectedFactoryLicense.ApproveUser}" />
-                    <TextBlock
-                        Grid.Row="10"
-                        Grid.Column="0"
-                        HorizontalAlignment="Right"
-                        VerticalAlignment="Center"
-                        Text="*审核人:"
-                        TextWrapping="Wrap" />
-                    <TextBox
-                        Grid.Row="10"
-                        Grid.Column="1"
-                        VerticalAlignment="Center"
-                        Text="{Binding SelectedFactoryLicense.AuditUser}" />
-
-
-
-                </Grid>
-            </ScrollViewer>
-        </Grid>
+        <TabControl>
+            <TabItem Header="许可证录入">
+                <license:FactoryLicenseInputPage />
+            </TabItem>
+            <TabItem Header="许可证管理">
+                <license:FactoryLicenseManagePage />
+            </TabItem>
+        </TabControl>
     </Grid>
 </UserControl>

+ 13 - 4
UniformMaterialManagementSystem/Views/FactoryLicensePage.xaml.cs

@@ -1,6 +1,17 @@
-using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
 using System.Windows.Controls;
-using UniformMaterialManagementSystem.ViewModels;
+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;
 
 namespace UniformMaterialManagementSystem.Views
 {
@@ -12,8 +23,6 @@ namespace UniformMaterialManagementSystem.Views
         public FactoryLicensePage()
         {
             InitializeComponent();
-
-            this.DataContext = App.Current.Services.GetServices<FactoryLicensePageViewModel>();
         }
     }
 }

+ 1 - 1
UniformMaterialManagementSystem/Views/InspectionReport/InspectionReportManagePage.xaml

@@ -630,7 +630,7 @@
                             Content="抽样送检"
                             Foreground="Red"
                             GroupName="IsSampleGroup"
-                            IsChecked="{Binding SelectedInspectionReport.IsSample, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
+                            IsChecked="{Binding SelectedInspectionReport.IsSample, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Unchecked="IsSampleRadioButton_Unchecked" />
                         <RadioButton
                             x:Name="NotSampleRadioButton"
                             Grid.Row="0"

+ 5 - 20
UniformMaterialManagementSystem/Views/InspectionReport/InspectionReportManagePage.xaml.cs

@@ -18,26 +18,6 @@ namespace UniformMaterialManagementSystem.Views.InspectionReport
 
         }
 
-        //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 Name_OnLostFocus(object sender, RoutedEventArgs e)
         {
             if (sender is not ComboBox comboBox) return;
@@ -53,5 +33,10 @@ namespace UniformMaterialManagementSystem.Views.InspectionReport
         {
             DataGridDetail.CommitEdit();
         }
+
+        private void IsSampleRadioButton_Unchecked(object sender, RoutedEventArgs e)
+        {
+            NotSampleRadioButton.IsChecked = !IsSampleRadioButton.IsChecked;
+        }
     }
 }