123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel.DataAnnotations;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using CommunityToolkit.Mvvm.ComponentModel;
- using UniformMaterialManagementSystem.Entities;
- namespace UniformMaterialManagementSystem.Models
- {
- public partial class InspectionReportModel : ObservableObject
- {
- [ObservableProperty]
- private Guid _guid;
- [ObservableProperty]
- private Guid _inspectApplyGuid;
- [ObservableProperty]
- private string _reportNo = null!;
- [ObservableProperty]
- private string _department = null!;
- [ObservableProperty]
- private DateTime _reportTime;
- [ObservableProperty]
- private string _reportBasis = null!;
- [ObservableProperty]
- private bool _isSample;
- [ObservableProperty]
- private string _reportDesc = null!;
- [ObservableProperty]
- private string _conclusion = null!;
- [ObservableProperty]
- private string _conclusionDesc = null!;
- [ObservableProperty]
- private string _editUser = null!;
- [ObservableProperty]
- private InspectApply _inspectApply = null!;
- [ObservableProperty]
- private string _purchaseCompanyNames = null!;
- [ObservableProperty]
- private string _contractNos = null!;
- [ObservableProperty]
- private int _year;
- [ObservableProperty]
- private ObservableCollection<InspectionReportDetail> _inspectionReportDetails = null!;
- public InspectionReportModel(InspectionReport report)
- {
- Guid = report.Guid;
- InspectApplyGuid = report.InspectApplyGuid;
- ReportNo = report.ReportNo;
- Department = report.Department;
- ReportTime = report.ReportTime;
- ReportBasis = report.ReportBasis;
- IsSample = report.IsSample;
- ReportDesc = report.ReportDesc;
- Conclusion = report.Conclusion;
- ConclusionDesc = report.ConclusionDesc;
- EditUser = report.EditUser;
- Year = report.Year;
- InspectApply = report.InspectApply;
- InspectionReportDetails = report.InspectionReportDetails;
- StringBuilder companyNames = new StringBuilder();
- StringBuilder contractNos = new StringBuilder();
- foreach (var detail in report.InspectApply.InspectApplyContractDetails)
- {
- companyNames.AppendLine(detail.PurchaseCompany);
- contractNos.AppendLine(detail.ContractNo);
- }
- PurchaseCompanyNames = companyNames.ToString();
- ContractNos = contractNos.ToString();
- }
- public void ModifyInspectionReport(InspectionReport report)
- {
- report.Guid = Guid;
- report.InspectApplyGuid = InspectApplyGuid ;
- report.ReportNo = ReportNo;
- report.Department = Department;
- report.ReportTime = ReportTime ;
- report.ReportBasis = ReportBasis;
- report.IsSample = IsSample;
- report.ReportDesc = ReportDesc;
- report.Conclusion = Conclusion;
- report.ConclusionDesc = ConclusionDesc;
- report.EditUser = EditUser;
- report.InspectApply = InspectApply;
- report.InspectionReportDetails = InspectionReportDetails;
- }
- }
- }
|