InspectionReportModel.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.ComponentModel.DataAnnotations;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using CommunityToolkit.Mvvm.ComponentModel;
  9. using UniformMaterialManagementSystem.Entities;
  10. namespace UniformMaterialManagementSystem.Models
  11. {
  12. public partial class InspectionReportModel : ObservableObject
  13. {
  14. [ObservableProperty]
  15. private Guid _guid;
  16. [ObservableProperty]
  17. private Guid _inspectApplyGuid;
  18. [ObservableProperty]
  19. private string _reportNo = null!;
  20. [ObservableProperty]
  21. private string _department = null!;
  22. [ObservableProperty]
  23. private DateTime _reportTime;
  24. [ObservableProperty]
  25. private string _reportBasis = null!;
  26. [ObservableProperty]
  27. private bool _isSample;
  28. [ObservableProperty]
  29. private string _reportDesc = null!;
  30. [ObservableProperty]
  31. private string _conclusion = null!;
  32. [ObservableProperty]
  33. private string _conclusionDesc = null!;
  34. [ObservableProperty]
  35. private string _editUser = null!;
  36. [ObservableProperty]
  37. private InspectApply _inspectApply = null!;
  38. [ObservableProperty]
  39. private string _purchaseCompanyNames = null!;
  40. [ObservableProperty]
  41. private string _contractNos = null!;
  42. [ObservableProperty]
  43. private int _year;
  44. [ObservableProperty]
  45. private ObservableCollection<InspectionReportDetail> _inspectionReportDetails = null!;
  46. public InspectionReportModel(InspectionReport report)
  47. {
  48. Guid = report.Guid;
  49. InspectApplyGuid = report.InspectApplyGuid;
  50. ReportNo = report.ReportNo;
  51. Department = report.Department;
  52. ReportTime = report.ReportTime;
  53. ReportBasis = report.ReportBasis;
  54. IsSample = report.IsSample;
  55. ReportDesc = report.ReportDesc;
  56. Conclusion = report.Conclusion;
  57. ConclusionDesc = report.ConclusionDesc;
  58. EditUser = report.EditUser;
  59. Year = report.Year;
  60. InspectApply = report.InspectApply;
  61. InspectionReportDetails = report.InspectionReportDetails;
  62. StringBuilder companyNames = new StringBuilder();
  63. StringBuilder contractNos = new StringBuilder();
  64. foreach (var detail in report.InspectApply.InspectApplyContractDetails)
  65. {
  66. companyNames.AppendLine(detail.PurchaseCompany);
  67. contractNos.AppendLine(detail.ContractNo);
  68. }
  69. PurchaseCompanyNames = companyNames.ToString();
  70. ContractNos = contractNos.ToString();
  71. }
  72. public void ModifyInspectionReport(InspectionReport report)
  73. {
  74. report.Guid = Guid;
  75. report.InspectApplyGuid = InspectApplyGuid ;
  76. report.ReportNo = ReportNo;
  77. report.Department = Department;
  78. report.ReportTime = ReportTime ;
  79. report.ReportBasis = ReportBasis;
  80. report.IsSample = IsSample;
  81. report.ReportDesc = ReportDesc;
  82. report.Conclusion = Conclusion;
  83. report.ConclusionDesc = ConclusionDesc;
  84. report.EditUser = EditUser;
  85. report.InspectApply = InspectApply;
  86. report.InspectionReportDetails = InspectionReportDetails;
  87. }
  88. }
  89. }