浏览代码

feat: 用户界面删除工号字段,发货单删除ApplyNo

JaneDoe 2 月之前
父节点
当前提交
bee4941a10

+ 0 - 3
UniformMaterialManagementSystem/Entities/DeliveryReceipt.cs

@@ -14,9 +14,6 @@ namespace UniformMaterialManagementSystem.Entities
         [Key]
         public Guid Guid { get; set; } = Guid.NewGuid();
 
-        // todo 用没用到,转为 NotMapped ?
-        public string ApplyNo { get; set; } = string.Empty;
-
         public Guid ContractGuid { get; set; } = default!;
 
         public string PurchaseCompanyName { get; set; } = default!;

+ 0 - 4
UniformMaterialManagementSystem/Entities/User.cs

@@ -9,10 +9,6 @@ namespace UniformMaterialManagementSystem.Entities
         [Key]
         public Guid Guid { get; set; } = Guid.NewGuid();
 
-        [Required]
-        [StringLength(50)]
-        public string IdNumber { get; set; } = null!;
-
         [Required]
         [StringLength(50)]
         public string LoginName { get; set; } = null!;

+ 1241 - 0
UniformMaterialManagementSystem/Migrations/20240903070148_delete_IdNumberAndApplyNo.Designer.cs

@@ -0,0 +1,1241 @@
+// <auto-generated />
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using UniformMaterialManagementSystem.Data;
+
+#nullable disable
+
+namespace UniformMaterialManagementSystem.Migrations
+{
+    [DbContext(typeof(SqliteContext))]
+    [Migration("20240903070148_delete_IdNumberAndApplyNo")]
+    partial class delete_IdNumberAndApplyNo
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder.HasAnnotation("ProductVersion", "7.0.20");
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.Company", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Address")
+                        .HasMaxLength(100)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Category")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Code")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("IsEnabled")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("Manager")
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Note")
+                        .HasMaxLength(100)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ShortName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("SystemCode")
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.ToTable("Companies");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.Contract", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<byte[]>("ApplyAttachment")
+                        .HasColumnType("BLOB");
+
+                    b.Property<byte[]>("Attachment")
+                        .HasColumnType("BLOB");
+
+                    b.Property<bool>("ChangedStatus")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<Guid>("CompanyGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ContractNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("EditDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("EditUser")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("ExportStatus")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<Guid>("PurchaseCompanyGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("SigningDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Telephone")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("Year")
+                        .HasColumnType("INTEGER");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("CompanyGuid");
+
+                    b.HasIndex("PurchaseCompanyGuid");
+
+                    b.ToTable("Contracts");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.ContractDetail", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("ContractGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("ContractQty")
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("DeliveryTime")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("InspectStatus")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("InspectedQty")
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("MaterialGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("ReduceQuantity")
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("ShippedQuantity")
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("ShippedStatus")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<decimal>("UnitPrice")
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("ContractGuid");
+
+                    b.HasIndex("MaterialGuid");
+
+                    b.ToTable("ContractDetails");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.DeliveryReceipt", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("CompanyName")
+                        .IsRequired()
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("ContractGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ContractNo")
+                        .IsRequired()
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("ContractQty")
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("ContractSigningDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("IsExportDelivery")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<bool>("IsExportReceive")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<bool>("IsExportUsage")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<byte[]>("Licence")
+                        .HasColumnType("BLOB");
+
+                    b.Property<string>("ProductName")
+                        .IsRequired()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("PurchaseCompanyName")
+                        .IsRequired()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ReceivedCompanyName")
+                        .IsRequired()
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime?>("ReceivedDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ReceivedMan")
+                        .HasColumnType("TEXT");
+
+                    b.Property<int?>("ReceivedPackets")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<decimal?>("ReceivedQty")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ReceivedStatus")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ReceivedTel")
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("ShippedDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ShippedMan")
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("ShippedPackets")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<decimal>("ShippedQty")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ShippedTel")
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("WorkYear")
+                        .HasColumnType("INTEGER");
+
+                    b.HasKey("Guid");
+
+                    b.ToTable("DeliveryReceipts");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.DeliveryReceiptDetail", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("BatchNo")
+                        .IsRequired()
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("DeliveryReceiptGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("PacketNo")
+                        .IsRequired()
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal?>("ReceiveQuantity")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ShipNote")
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("ShippedQuantity")
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal?>("UsageQuantity")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("UsageStatus")
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("DeliveryReceiptGuid");
+
+                    b.ToTable("DeliveryReceiptDetails");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.FactoryLicense", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ApproveUser")
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("AuditUser")
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Department")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("EditUser")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("FactoryDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("FactoryQuantity")
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("InspectApplyGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("LicenseListNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("LicenseNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("SignDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("Year")
+                        .HasColumnType("INTEGER");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("InspectApplyGuid");
+
+                    b.ToTable("FactoryLicenses");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectApply", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ApplyDescription")
+                        .HasMaxLength(1000)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ApplyNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime?>("ApplyReceiveDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ApplyUser")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("BatchNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Company")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("CompanyGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("EndProductDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("ExportStatus")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("InspCategory")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("InspDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("InspQuantity")
+                        .HasColumnType("TEXT");
+
+                    b.Property<byte[]>("InspReport")
+                        .HasColumnType("BLOB");
+
+                    b.Property<string>("InspReportNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("LicenseStatus")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<Guid>("MaterialGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ProductName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("ReportStatus")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<bool>("SampleStatus")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<DateTime>("StartProductDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("Year")
+                        .HasColumnType("INTEGER");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("CompanyGuid");
+
+                    b.HasIndex("MaterialGuid");
+
+                    b.ToTable("InspectApplies");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectApplyContractDetail", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("ApplyGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ApplyNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("ContractDetailGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ContractNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("InspectQty")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("PurchaseCompany")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("PurchaseCompanyShortName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("SigningDate")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("UnInspectQty")
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("ApplyGuid");
+
+                    b.ToTable("InspectApplyContractDetails");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectApplyDetail", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("ApplyGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ApplyNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Note")
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("PacketNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("Quantity")
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("ShippedStatus")
+                        .HasColumnType("INTEGER");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("ApplyGuid");
+
+                    b.ToTable("InspectApplyDetails");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectionOrganization", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Address")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Contacts")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("IsEnabled")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("OrderNo")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("Telephone")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.ToTable("InspectionOrganizations");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectionReport", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Conclusion")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ConclusionDesc")
+                        .IsRequired()
+                        .HasMaxLength(1000)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Department")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("EditUser")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("InspectApplyGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("IsSample")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("ReportBasis")
+                        .IsRequired()
+                        .HasMaxLength(200)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ReportDesc")
+                        .IsRequired()
+                        .HasMaxLength(1000)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ReportNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("ReportTime")
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("Year")
+                        .HasColumnType("INTEGER");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("InspectApplyGuid")
+                        .IsUnique();
+
+                    b.ToTable("InspectionReports");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectionReportDetail", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("InspectionReportGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Inspector")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("JobCategory")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("SupervisionUnit")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("InspectionReportGuid");
+
+                    b.ToTable("InspectionReportDetails");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.Material", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("CategoryCode")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("IsEnabled")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("MeasureUnit")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("NormName")
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Note")
+                        .HasMaxLength(100)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Specification")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("VarietyCode")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.ToTable("Materials");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.MenuItem", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Icon")
+                        .HasMaxLength(100)
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("IsEnabled")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<bool>("IsVisible")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("OrderIndex")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<Guid?>("ParentGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Path")
+                        .HasMaxLength(100)
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("ParentGuid");
+
+                    b.ToTable("MenuItems");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.Role", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Description")
+                        .IsRequired()
+                        .HasMaxLength(100)
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("IsEnabled")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.ToTable("Roles");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.RoleMenuItem", b =>
+                {
+                    b.Property<Guid>("MenuItemGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("RoleGuid")
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("MenuItemGuid", "RoleGuid");
+
+                    b.HasIndex("RoleGuid");
+
+                    b.ToTable("RoleMenuItems");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.SampleRegistration", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("BatchNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Department")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("EditTime")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("EditUser")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("InspectApplyGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("InspectionOrganization")
+                        .IsRequired()
+                        .HasMaxLength(500)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("PacketNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("ProductDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ProductUsers")
+                        .HasMaxLength(100)
+                        .HasColumnType("TEXT");
+
+                    b.Property<decimal>("Quantity")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("SampleNo")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("SingleIndexItem")
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Telephone")
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("TestingItem")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("Year")
+                        .HasColumnType("INTEGER");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("InspectApplyGuid")
+                        .IsUnique();
+
+                    b.ToTable("SampleRegistrations");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.SerialNumber", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("CompanyCode")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("CompanyGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("InspCategory")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("MaxNumber")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("SupervisionUnitGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("Year")
+                        .HasColumnType("INTEGER");
+
+                    b.HasKey("Guid");
+
+                    b.ToTable("SerialNumbers");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.SupervisionUnit", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("IsEnabled")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Note")
+                        .HasMaxLength(100)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("ShortName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.ToTable("SupervisionUnits");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.User", b =>
+                {
+                    b.Property<Guid>("Guid")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid?>("CompanyGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("CompanyName")
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("IsEnabled")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("LoginName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Password")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<DateTime>("RegisterDate")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("Salt")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("SupervisionUnitGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<string>("UserName")
+                        .IsRequired()
+                        .HasMaxLength(50)
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("Guid");
+
+                    b.HasIndex("CompanyGuid");
+
+                    b.HasIndex("SupervisionUnitGuid");
+
+                    b.ToTable("Users");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.UserRole", b =>
+                {
+                    b.Property<Guid>("RoleGuid")
+                        .HasColumnType("TEXT");
+
+                    b.Property<Guid>("UserGuid")
+                        .HasColumnType("TEXT");
+
+                    b.HasKey("RoleGuid", "UserGuid");
+
+                    b.HasIndex("UserGuid");
+
+                    b.ToTable("UserRoles");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.Contract", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.Company", "Company")
+                        .WithMany()
+                        .HasForeignKey("CompanyGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("UniformMaterialManagementSystem.Entities.Company", "PurchaseCompany")
+                        .WithMany()
+                        .HasForeignKey("PurchaseCompanyGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Company");
+
+                    b.Navigation("PurchaseCompany");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.ContractDetail", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.Contract", "Contract")
+                        .WithMany("ContractDetails")
+                        .HasForeignKey("ContractGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("UniformMaterialManagementSystem.Entities.Material", "Material")
+                        .WithMany()
+                        .HasForeignKey("MaterialGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Contract");
+
+                    b.Navigation("Material");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.DeliveryReceiptDetail", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.DeliveryReceipt", null)
+                        .WithMany("DeliveryReceiptDetails")
+                        .HasForeignKey("DeliveryReceiptGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.FactoryLicense", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.InspectApply", "InspectApply")
+                        .WithMany()
+                        .HasForeignKey("InspectApplyGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("InspectApply");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectApply", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.Company", "MaterialCompany")
+                        .WithMany()
+                        .HasForeignKey("CompanyGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("UniformMaterialManagementSystem.Entities.Material", "Material")
+                        .WithMany()
+                        .HasForeignKey("MaterialGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Material");
+
+                    b.Navigation("MaterialCompany");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectApplyContractDetail", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.InspectApply", "InspectApply")
+                        .WithMany("InspectApplyContractDetails")
+                        .HasForeignKey("ApplyGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("InspectApply");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectApplyDetail", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.InspectApply", "InspectApply")
+                        .WithMany("InspectApplyDetails")
+                        .HasForeignKey("ApplyGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("InspectApply");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectionReport", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.InspectApply", "InspectApply")
+                        .WithOne("InspectionReport")
+                        .HasForeignKey("UniformMaterialManagementSystem.Entities.InspectionReport", "InspectApplyGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("InspectApply");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectionReportDetail", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.InspectionReport", "InspectionReport")
+                        .WithMany("InspectionReportDetails")
+                        .HasForeignKey("InspectionReportGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("InspectionReport");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.MenuItem", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.MenuItem", "Parent")
+                        .WithMany("Children")
+                        .HasForeignKey("ParentGuid")
+                        .OnDelete(DeleteBehavior.Restrict);
+
+                    b.Navigation("Parent");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.RoleMenuItem", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.MenuItem", "MenuItem")
+                        .WithMany("MenuRoles")
+                        .HasForeignKey("MenuItemGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("UniformMaterialManagementSystem.Entities.Role", "Role")
+                        .WithMany("RoleMenus")
+                        .HasForeignKey("RoleGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("MenuItem");
+
+                    b.Navigation("Role");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.SampleRegistration", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.InspectApply", "InspectApply")
+                        .WithOne("SampleRegistration")
+                        .HasForeignKey("UniformMaterialManagementSystem.Entities.SampleRegistration", "InspectApplyGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("InspectApply");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.User", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.Company", "Company")
+                        .WithMany()
+                        .HasForeignKey("CompanyGuid");
+
+                    b.HasOne("UniformMaterialManagementSystem.Entities.SupervisionUnit", "SupervisionUnit")
+                        .WithMany()
+                        .HasForeignKey("SupervisionUnitGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Company");
+
+                    b.Navigation("SupervisionUnit");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.UserRole", b =>
+                {
+                    b.HasOne("UniformMaterialManagementSystem.Entities.Role", "Role")
+                        .WithMany("UserRoles")
+                        .HasForeignKey("RoleGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("UniformMaterialManagementSystem.Entities.User", "User")
+                        .WithMany("UserRoles")
+                        .HasForeignKey("UserGuid")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Role");
+
+                    b.Navigation("User");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.Contract", b =>
+                {
+                    b.Navigation("ContractDetails");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.DeliveryReceipt", b =>
+                {
+                    b.Navigation("DeliveryReceiptDetails");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectApply", b =>
+                {
+                    b.Navigation("InspectApplyContractDetails");
+
+                    b.Navigation("InspectApplyDetails");
+
+                    b.Navigation("InspectionReport");
+
+                    b.Navigation("SampleRegistration");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectionReport", b =>
+                {
+                    b.Navigation("InspectionReportDetails");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.MenuItem", b =>
+                {
+                    b.Navigation("Children");
+
+                    b.Navigation("MenuRoles");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.Role", b =>
+                {
+                    b.Navigation("RoleMenus");
+
+                    b.Navigation("UserRoles");
+                });
+
+            modelBuilder.Entity("UniformMaterialManagementSystem.Entities.User", b =>
+                {
+                    b.Navigation("UserRoles");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 60 - 0
UniformMaterialManagementSystem/Migrations/20240903070148_delete_IdNumberAndApplyNo.cs

@@ -0,0 +1,60 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace UniformMaterialManagementSystem.Migrations
+{
+    /// <inheritdoc />
+    public partial class delete_IdNumberAndApplyNo : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropIndex(
+                name: "IX_SampleRegistrations_InspectApplyGuid",
+                table: "SampleRegistrations");
+
+            migrationBuilder.DropColumn(
+                name: "IdNumber",
+                table: "Users");
+
+            migrationBuilder.DropColumn(
+                name: "ApplyNo",
+                table: "DeliveryReceipts");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_SampleRegistrations_InspectApplyGuid",
+                table: "SampleRegistrations",
+                column: "InspectApplyGuid",
+                unique: true);
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropIndex(
+                name: "IX_SampleRegistrations_InspectApplyGuid",
+                table: "SampleRegistrations");
+
+            migrationBuilder.AddColumn<string>(
+                name: "IdNumber",
+                table: "Users",
+                type: "TEXT",
+                maxLength: 50,
+                nullable: false,
+                defaultValue: "");
+
+            migrationBuilder.AddColumn<string>(
+                name: "ApplyNo",
+                table: "DeliveryReceipts",
+                type: "TEXT",
+                nullable: false,
+                defaultValue: "");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_SampleRegistrations_InspectApplyGuid",
+                table: "SampleRegistrations",
+                column: "InspectApplyGuid");
+        }
+    }
+}

+ 6 - 12
UniformMaterialManagementSystem/Migrations/SqliteContextModelSnapshot.cs

@@ -177,10 +177,6 @@ namespace UniformMaterialManagementSystem.Migrations
                         .ValueGeneratedOnAdd()
                         .HasColumnType("TEXT");
 
-                    b.Property<string>("ApplyNo")
-                        .IsRequired()
-                        .HasColumnType("TEXT");
-
                     b.Property<string>("CompanyName")
                         .IsRequired()
                         .HasColumnType("TEXT");
@@ -860,7 +856,8 @@ namespace UniformMaterialManagementSystem.Migrations
 
                     b.HasKey("Guid");
 
-                    b.HasIndex("InspectApplyGuid");
+                    b.HasIndex("InspectApplyGuid")
+                        .IsUnique();
 
                     b.ToTable("SampleRegistrations");
                 });
@@ -941,11 +938,6 @@ namespace UniformMaterialManagementSystem.Migrations
                         .HasMaxLength(50)
                         .HasColumnType("TEXT");
 
-                    b.Property<string>("IdNumber")
-                        .IsRequired()
-                        .HasMaxLength(50)
-                        .HasColumnType("TEXT");
-
                     b.Property<bool>("IsEnabled")
                         .HasColumnType("INTEGER");
 
@@ -1152,8 +1144,8 @@ namespace UniformMaterialManagementSystem.Migrations
             modelBuilder.Entity("UniformMaterialManagementSystem.Entities.SampleRegistration", b =>
                 {
                     b.HasOne("UniformMaterialManagementSystem.Entities.InspectApply", "InspectApply")
-                        .WithMany()
-                        .HasForeignKey("InspectApplyGuid")
+                        .WithOne("SampleRegistration")
+                        .HasForeignKey("UniformMaterialManagementSystem.Entities.SampleRegistration", "InspectApplyGuid")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
 
@@ -1213,6 +1205,8 @@ namespace UniformMaterialManagementSystem.Migrations
                     b.Navigation("InspectApplyDetails");
 
                     b.Navigation("InspectionReport");
+
+                    b.Navigation("SampleRegistration");
                 });
 
             modelBuilder.Entity("UniformMaterialManagementSystem.Entities.InspectionReport", b =>

+ 0 - 1
UniformMaterialManagementSystem/Models/LoginUser.cs

@@ -7,7 +7,6 @@ namespace UniformMaterialManagementSystem.Models
         public LoginUser(User user)
         {
             Guid = user.Guid;
-            IdNumber = user.IdNumber;
             LoginName = user.LoginName;
             UserName = user.UserName;
             Password = user.Password;

+ 1 - 6
UniformMaterialManagementSystem/Models/UserModel.cs

@@ -11,9 +11,6 @@ namespace UniformMaterialManagementSystem.Models
         [ObservableProperty]
         private Guid _guid = Guid.NewGuid();
 
-        [ObservableProperty]
-        private string _idNumber = null!;
-
         [ObservableProperty]
         private string _loginName = null!;
 
@@ -38,7 +35,6 @@ namespace UniformMaterialManagementSystem.Models
         [ObservableProperty]
         private Company? _company;
 
-        // todo 弃用标签?
         [ObservableProperty]
         private string? _companyName;
 
@@ -75,7 +71,6 @@ namespace UniformMaterialManagementSystem.Models
             LoginName = user.LoginName;
             Password = user.Password;
             UserName = user.UserName;
-            IdNumber = user.IdNumber;
             CompanyName = user.CompanyName;
             RegisterDate = user.RegisterDate;
             RoleName = user.Roles.Count > 0 ? user.Roles[0].Name : "";
@@ -89,7 +84,6 @@ namespace UniformMaterialManagementSystem.Models
         public UserModel(User user, bool isNewRow, string selectedRoleText)
         {
             Guid = user.Guid;
-            IdNumber = user.IdNumber;
             LoginName = user.LoginName;
             UserName = user.UserName;
             Password = user.Password;
@@ -98,6 +92,7 @@ namespace UniformMaterialManagementSystem.Models
             SupervisionUnit = user.SupervisionUnit;
             CompanyGuid = user.CompanyGuid;
             Company = user.Company;
+            CompanyName = user.CompanyName;
             RegisterDate = user.RegisterDate;
             Roles = user.Roles;
             UserRoles = user.UserRoles;

+ 1 - 2
UniformMaterialManagementSystem/ViewModels/RegisterPageViewModel.cs

@@ -126,8 +126,7 @@ namespace UniformMaterialManagementSystem.ViewModels
                 RegisterDate = DateTime.Now,
                 Roles = [_roles[SelectedUnitType]],
                 SupervisionUnit = SelectedUnit,
-                SupervisionUnitGuid = SelectedUnit.Guid,
-                IdNumber = string.Empty
+                SupervisionUnitGuid = SelectedUnit.Guid
             };
 
             await _service.InsertAsync(user);

+ 47 - 66
UniformMaterialManagementSystem/ViewModels/UsersViewModel.cs

@@ -70,7 +70,7 @@ namespace UniformMaterialManagementSystem.ViewModels
 
         public UsersViewModel(IDataBaseService<User> service)
         {
-            // todo 设置工号、登录名、密码,只接受字母和数字:数据校验和 ObservableProperty 冲突
+            // todo 设置登录名、密码,只接受字母和数字:数据校验和 ObservableProperty 冲突
 
             _service = service;
 
@@ -98,25 +98,21 @@ namespace UniformMaterialManagementSystem.ViewModels
         private void Loaded(DataGrid dataGridUser)
         {
             // 加载时设置列标题、可读性
-
-            DataGridTextColumn? colIdNumber = dataGridUser.Columns.Where(x => x.Header.ToString()!.StartsWith("工号")).FirstOrDefault() as DataGridTextColumn;
             DataGridComboBoxColumn? colSupUnit = dataGridUser.Columns.Where(x => x.Header.ToString()!.StartsWith("监管单位")).FirstOrDefault() as DataGridComboBoxColumn;
             DataGridComboBoxColumn? colCompany = dataGridUser.Columns.Where(x => x.Header.ToString()!.StartsWith("生产企业")).FirstOrDefault() as DataGridComboBoxColumn;
-            if (colIdNumber == null || colSupUnit == null || colCompany == null) { return; }
+            if (colSupUnit == null || colCompany == null) { return; }
 
-            var adminOrSupUnitRoles = _currUser.Roles.Where(x => x.Name.Equals("Admin") || x.Name.Contains("Supervision"));
+            var adminOrSupUnitRoles = _currUser.Roles.Where(x => x.Name.Equals("Admin") || x.Name.StartsWith("Supervision"));
             if (adminOrSupUnitRoles.Any())
             {
                 // 当前用户为 超级管理员、区域站管理员、区域站用用户 时 ,监管单位和生产企业列可编辑,列标题同时展示两种,生产企业必录
                 colSupUnit.IsReadOnly = colCompany.IsReadOnly = false;
-                colIdNumber.Header = "工号/证件号码*";
                 colSupUnit.Header = "监管单位/所在单位*";
                 colCompany.Header = "生产企业";
             }
             else
             {
                 colSupUnit.IsReadOnly = colCompany.IsReadOnly = true;
-                colIdNumber.Header = "工号*";
                 colSupUnit.Header = "监管单位*";
                 colCompany.Header = "生产企业*";
             }
@@ -321,11 +317,12 @@ namespace UniformMaterialManagementSystem.ViewModels
         [RelayCommand]
         private void Save(DataGrid dataGridUser)
         {
-            // 取消选中正在编辑的单元格
+            // 提交编辑
+            dataGridUser.CommitEdit();
             dataGridUser.UnselectAllCells();
 
             // 删除空行
-            var emptyRows = UserModels.Where(x => x.IsNewRow && string.IsNullOrEmpty(x.IdNumber) && string.IsNullOrEmpty(x.LoginName) && string.IsNullOrEmpty(x.UserName) && x.SupervisionUnit == null && x.Company == null && (x.Roles == null || x.Roles.Count == 0));
+            var emptyRows = UserModels.Where(x => x.IsNewRow && string.IsNullOrEmpty(x.LoginName) && string.IsNullOrEmpty(x.UserName) && x.SupervisionUnit == null && x.Company == null && (x.Roles == null || x.Roles.Count == 0));
             if (emptyRows.Any())
             {
                 for (int i = emptyRows.Count() - 1; i >= 0; i--)
@@ -340,8 +337,14 @@ namespace UniformMaterialManagementSystem.ViewModels
             IEnumerable<UserModel> nullRows = null!;
             if (_isCompanyUser)
             {
-                // 企业端前五列必录
-                nullRows = UserModels.Where(x => x.IsNewRow && (string.IsNullOrEmpty(x.IdNumber) || string.IsNullOrEmpty(x.LoginName) || string.IsNullOrEmpty(x.UserName) || x.SupervisionUnit == null || string.IsNullOrEmpty(x.SupervisionUnitGuid.ToString()) || x.Company == null || string.IsNullOrEmpty(x.CompanyGuid.ToString())));
+                // 企业端的登录名、用户名、监管单位、生产企业、角色列必录
+                nullRows = UserModels.Where(x => x.IsNewRow
+                                                 && (string.IsNullOrEmpty(x.LoginName)
+                                                     || string.IsNullOrEmpty(x.UserName)
+                                                     || x.SupervisionUnit == null || string.IsNullOrEmpty(x.SupervisionUnitGuid.ToString())
+                                                     || x.Company == null || string.IsNullOrEmpty(x.CompanyGuid.ToString())
+                                                     || x.Roles == null || x.Roles.Count == 0)
+                                            );
                 if (nullRows.Count() > 0)
                 {
                     // 如果存在未填的必录项,则提示
@@ -349,16 +352,20 @@ namespace UniformMaterialManagementSystem.ViewModels
                     {
                         // 记录每一行第一个为空的列索引
                         int rowIndex = UserModels.IndexOf(nullItem);
-                        int firstColIndex = string.IsNullOrEmpty(nullItem.IdNumber) ? 0 : string.IsNullOrEmpty(nullItem.LoginName) ? 1 : string.IsNullOrEmpty(nullItem.UserName) ? 2 : nullItem.SupervisionUnit == null || string.IsNullOrEmpty(nullItem.SupervisionUnit.ToString()) ? 3 : 4;
+                        int firstColIndex = string.IsNullOrEmpty(nullItem.LoginName) ? 0
+                                            : string.IsNullOrEmpty(nullItem.UserName) ? 1
+                                            : nullItem.SupervisionUnit == null || string.IsNullOrEmpty(nullItem.SupervisionUnit.ToString()) ? 2
+                                            : nullItem.Company == null || string.IsNullOrEmpty(nullItem.CompanyGuid.ToString()) ? 3
+                                            : 4;
                         nullIndexes.Add(rowIndex, firstColIndex);
 
                         // 拼接所有为空的列
                         StringBuilder nullCaptions = new StringBuilder();
-                        nullCaptions = string.IsNullOrEmpty(nullItem.IdNumber) ? nullCaptions.Append("“工号/证件号码”、") : nullCaptions;
                         nullCaptions = string.IsNullOrEmpty(nullItem.LoginName) ? nullCaptions.Append("“登录名”、") : nullCaptions;
                         nullCaptions = string.IsNullOrEmpty(nullItem.UserName) ? nullCaptions.Append("“用户名”、") : nullCaptions;
                         nullCaptions = nullItem.SupervisionUnit == null || string.IsNullOrEmpty(nullItem.SupervisionUnit.ToString()) ? nullCaptions.Append("“监管单位/所在单位”、") : nullCaptions;
                         nullCaptions = nullItem.Company == null || string.IsNullOrEmpty(nullItem.CompanyGuid.ToString()) ? nullCaptions.Append("“生产企业”、") : nullCaptions;
+                        nullCaptions = nullItem.Roles == null || nullItem.Roles.Count == 0 ? nullCaptions.Append("“角色”、") : nullCaptions;
                         nullCaptions = nullCaptions.Remove(nullCaptions.Length - 1, 1);
                         nullMsg.Append($"\n第{rowIndex + 1}行的{nullCaptions}");
                     }
@@ -373,8 +380,13 @@ namespace UniformMaterialManagementSystem.ViewModels
             }
             else
             {
-                // 区域站前四列必录
-                nullRows = UserModels.Where(x => x.IsNewRow && (string.IsNullOrEmpty(x.IdNumber) || string.IsNullOrEmpty(x.LoginName) || string.IsNullOrEmpty(x.UserName) || x.SupervisionUnit == null || string.IsNullOrEmpty(x.SupervisionUnitGuid.ToString())));
+                // 区域站登录名、用户名、监管单位、角色列必录
+                nullRows = UserModels.Where(x => x.IsNewRow
+                                                 && (string.IsNullOrEmpty(x.LoginName)
+                                                     || string.IsNullOrEmpty(x.UserName)
+                                                     || x.SupervisionUnit == null || string.IsNullOrEmpty(x.SupervisionUnitGuid.ToString())
+                                                     || x.Roles == null || x.Roles.Count == 0)
+                                            );
                 if (nullRows.Count() > 0)
                 {
                     // 如果存在未填的必录项,则提示
@@ -382,17 +394,20 @@ namespace UniformMaterialManagementSystem.ViewModels
                     {
                         // 记录每一行第一个为空的列索引
                         int rowIndex = UserModels.IndexOf(nullRow);
-                        int firstColIndex = string.IsNullOrEmpty(nullRow.IdNumber) ? 0 : string.IsNullOrEmpty(nullRow.LoginName) ? 1 : string.IsNullOrEmpty(nullRow.UserName) ? 2 : 3;
+                        int firstColIndex = string.IsNullOrEmpty(nullRow.LoginName) ? 0
+                                            : string.IsNullOrEmpty(nullRow.UserName) ? 1
+                                            : nullRow.SupervisionUnit == null || string.IsNullOrEmpty(nullRow.SupervisionUnitGuid.ToString()) ? 2
+                                            : 4;
                         nullIndexes.Add(rowIndex, firstColIndex);
 
                         // 拼接所有为空的列
                         StringBuilder nullCaptions = new StringBuilder();
-                        nullCaptions = string.IsNullOrEmpty(nullRow.IdNumber) ? nullCaptions.Append("工号/证件号码、") : nullCaptions;
-                        nullCaptions = string.IsNullOrEmpty(nullRow.LoginName) ? nullCaptions.Append("登录名、") : nullCaptions;
-                        nullCaptions = string.IsNullOrEmpty(nullRow.UserName) ? nullCaptions.Append("用户名、") : nullCaptions;
-                        nullCaptions = nullRow.SupervisionUnit == null || string.IsNullOrEmpty(nullRow.SupervisionUnit.ToString()) ? nullCaptions.Append("监管单位、") : nullCaptions;
+                        nullCaptions = string.IsNullOrEmpty(nullRow.LoginName) ? nullCaptions.Append("“登录名”、") : nullCaptions;
+                        nullCaptions = string.IsNullOrEmpty(nullRow.UserName) ? nullCaptions.Append("“用户名”、") : nullCaptions;
+                        nullCaptions = nullRow.SupervisionUnit == null || string.IsNullOrEmpty(nullRow.SupervisionUnit.ToString()) ? nullCaptions.Append("“监管单位”、") : nullCaptions;
+                        nullCaptions = nullRow.Roles == null || nullRow.Roles.Count == 0 ? nullCaptions.Append("“角色”、") : nullCaptions;
                         nullCaptions = nullCaptions.Remove(nullCaptions.Length - 1, 1);
-                        nullMsg.Append($"\n第{rowIndex + 1}行的{nullCaptions}");
+                        nullMsg.Append($"\n第{rowIndex + 1}行的{nullCaptions}");
                     }
                     MessageBox.Show($"以下未填项为必录项,不允许保存:" + nullMsg.ToString(), "错误", MessageBoxButton.OK, MessageBoxImage.Error);
 
@@ -416,7 +431,7 @@ namespace UniformMaterialManagementSystem.ViewModels
                         if (row.Roles == null || row.Roles.Count == 0) { continue; }
 
                         // 若勾选了 超级管理员 和 区域站端用户,跳过
-                        var adminRoles = row.Roles.Where(x => x.Name.Equals("Admin") || x.Name.Equals("SupervisionAdmin") || x.Name.Equals("SupervisionUser"));
+                        var adminRoles = row.Roles.Where(x => x.Name.Equals("Admin") || x.Name.StartsWith("Supervision"));
                         if (adminRoles.Any()) { continue; }
 
                         // 记录行索引
@@ -439,9 +454,9 @@ namespace UniformMaterialManagementSystem.ViewModels
                 }
             }
 
-            // 检查新增行的工号和登录名是否只有数字和字母
+            // 检查新增行的登录名是否只有数字和字母
             Regex regex = new Regex(@"^[0-9a-zA-Z]*$");
-            var illegalRows = UserModels.Where(x => x.IsNewRow && (!regex.IsMatch(x.IdNumber) || !regex.IsMatch(x.LoginName)));
+            var illegalRows = UserModels.Where(x => x.IsNewRow && !regex.IsMatch(x.LoginName));
             if (illegalRows.Any())
             {
                 StringBuilder illegalMsg = new StringBuilder();
@@ -450,63 +465,32 @@ namespace UniformMaterialManagementSystem.ViewModels
                 foreach (var illegalRow in illegalRows)
                 {
                     int rowIndex = UserModels.IndexOf(illegalRow);
-                    int colIndex = -1;
-                    if (!regex.IsMatch(illegalRow.LoginName))
-                    {
-                        illegalMsg.Append($"\n第 {rowIndex} 行的登录名 '{illegalRow.LoginName}'");
-                        colIndex = 1;
-                    }
-                    if (!regex.IsMatch(illegalRow.IdNumber))
-                    {
-                        illegalMsg.Append($"\n第 {rowIndex} 行的工号 '{illegalRow.IdNumber}'");
-                        colIndex = 0;
-                    }
-                    illegalIndexes.Add(rowIndex, colIndex);
+                    illegalMsg.Append($"\n第 {rowIndex} 行: '{illegalRow.LoginName}'");
 
+                    illegalIndexes.Add(rowIndex, 1);
                     firstIllegalRowIndex = firstIllegalRowIndex < rowIndex ? firstIllegalRowIndex : rowIndex;
                 }
 
                 // 提示用户
-                string idColCaption = _isCompanyUser ? "工号" : "工号/证件号码";
-                MessageBox.Show($"{idColCaption}、登录名列只接收数字或字母,以下数据不合法,请修改后再次保存:" + illegalMsg.ToString(), "错误", MessageBoxButton.OK, MessageBoxImage.Error);
+                MessageBox.Show($"登录名列只接收数字或字母,以下数据不合法,请修改后再次保存:" + illegalMsg.ToString(), "错误", MessageBoxButton.OK, MessageBoxImage.Error);
 
                 // 定位到第一个非法的数据
                 SetCellEditing(dataGridUser, firstIllegalRowIndex, illegalIndexes[firstIllegalRowIndex]);
                 return;
             }
 
-            // 保存时检查前三列是否存在重复项
-            var repeatIdNumbers = UserModels.GroupBy(x => x.IdNumber).Where(g => g.Count() > 1).Select(g => g.Key);
+            // 保存时检查登录名和用户名是否存在重复项
             var repeatLoginNames = UserModels.GroupBy(x => x.LoginName).Where(g => g.Count() > 1).Select(g => g.Key);
             var repeatUserNames = UserModels.GroupBy(x => x.UserName).Where(g => g.Count() > 1).Select(g => g.Key);
             StringBuilder repeatMsg = new StringBuilder();
             Dictionary<int, int> repeatIndexes = new Dictionary<int, int>();
             int firstRepeatRowIndex = UserModels.Count;
-            if (repeatIdNumbers.Any())
-            {
-                string repeatIdNumberText = string.Join("、", repeatIdNumbers.ToArray());
-                repeatMsg.Append($"\n工号/证件号码存在重复值[{repeatIdNumberText}]");
-
-                // todo 唯一索引
-                // 记录重复项的索引:导入重复编码后已保存数据可能存在重复项
-                //UserModel? repeatIdNumberRow = UserModels.Where(x => x.IsNewRow && repeatIdNumbers.Contains(x.IdNumber)).FirstOrDefault();
-                UserModel? repeatIdNumberRow = UserModels.Where(x => repeatIdNumbers.Contains(x.IdNumber)).FirstOrDefault();
-                if (repeatIdNumberRow == null) { return; }
-                int rowIndex = UserModels.IndexOf(repeatIdNumberRow);
-                if (!repeatIndexes.ContainsKey(rowIndex))
-                {
-                    repeatIndexes.Add(rowIndex, 0);
-                }
-
-                firstRepeatRowIndex = firstRepeatRowIndex < rowIndex ? firstRepeatRowIndex : rowIndex;
-            }
             if (repeatLoginNames.Any())
             {
                 string repeatLoginNameText = string.Join("、", repeatLoginNames.ToArray());
                 repeatMsg.Append($"\n登录名存在重复值[{repeatLoginNameText}]");
 
-                // 记录重复项的索引
-                //UserModel? repeatLoginNameRow = UserModels.Where(x => x.IsNewRow && repeatLoginNames.Contains(x.LoginName)).FirstOrDefault();
+                // 记录重复项的索引:导入数据后可能会出现重复的登录名
                 UserModel? repeatLoginNameRow = UserModels.Where(x => repeatLoginNames.Contains(x.LoginName)).FirstOrDefault();
                 if (repeatLoginNameRow == null) { return; }
                 int rowIndex = UserModels.IndexOf(repeatLoginNameRow);
@@ -523,7 +507,6 @@ namespace UniformMaterialManagementSystem.ViewModels
                 repeatMsg.Append($"\n用户名存在重复值[{repeatUserNameText}]");
 
                 // 记录重复项的索引
-                //UserModel? repeatUserNameRow = UserModels.Where(x => x.IsNewRow && repeatUserNames.Contains(x.UserName)).FirstOrDefault();
                 UserModel? repeatUserNameRow = UserModels.Where(x => repeatUserNames.Contains(x.UserName)).FirstOrDefault();
                 if (repeatUserNameRow == null) { return; }
                 int rowIndex = UserModels.IndexOf(repeatUserNameRow);
@@ -538,7 +521,7 @@ namespace UniformMaterialManagementSystem.ViewModels
             // 若存在重复项则提示后返回
             if (repeatMsg.Length > 0)
             {
-                MessageBox.Show("工号/证件号、登录名、用户名列存在重复项,请修改后保存:" + repeatMsg.ToString(), "错误", MessageBoxButton.OK, MessageBoxImage.Error);
+                MessageBox.Show("登录名、用户名列存在重复项,请修改后保存:" + repeatMsg.ToString(), "错误", MessageBoxButton.OK, MessageBoxImage.Error);
 
                 // 定位到第一个重复项
                 int repeatColIndex = repeatIndexes[firstRepeatRowIndex];
@@ -558,7 +541,6 @@ namespace UniformMaterialManagementSystem.ViewModels
                 User? user = new User()
                 {
                     Guid = useModel.Guid,
-                    IdNumber = useModel.IdNumber,
                     LoginName = useModel.LoginName,
                     UserName = useModel.UserName,
                     Password = useModel.Password,
@@ -642,13 +624,12 @@ namespace UniformMaterialManagementSystem.ViewModels
                 }
             }
 
-            // 用户数据(默认按照 IdNumber 进行排序)
+            // 用户数据(默认按照 LoginName 进行排序)
             if (_service == null) { return; }
-            // todo  Include() 哪几列?
             var data = _service?.Query(x => x.IsEnabled)
                                 .Include(x => x.UserRoles)
                                 .Include(x => x.Roles)
-                                .OrderBy(x => x.IdNumber);
+                                .OrderBy(x => x.LoginName);
             var data0 = _service?.Query(x => x.IsEnabled)
                                  .Include(x => x.SupervisionUnit)
                                  .Include(x => x.Roles)

+ 1 - 10
UniformMaterialManagementSystem/Views/UsersControl.xaml

@@ -250,13 +250,6 @@
 
             <!-- 数据列 -->
             <DataGrid.Columns>
-                <!-- todo 设置排序没生效? -->
-                <DataGridTextColumn Header="工号/证件号码*" Width="*" 
-                                    Binding="{Binding IdNumber, UpdateSourceTrigger=PropertyChanged}"
-                                    SortMemberPath="IdNumber"
-                                    SortDirection="Descending"
-                                    EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
-                                    ElementStyle="{StaticResource TextColumnElementStyle}" />
                 <DataGridTextColumn Header="登录名*" Width="*" 
                                     Binding="{Binding LoginName, UpdateSourceTrigger=PropertyChanged}"
                                     EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
@@ -331,8 +324,7 @@
                             <TextBlock x:Name="tbMultiRole"
                                        VerticalAlignment="Center"
                                        HorizontalAlignment="Center"
-                                       Text="{Binding SelectedRoleText}"
-                                       Loaded="TBMultiRole_Loaded" />
+                                       Text="{Binding SelectedRoleText}" />
                         </DataTemplate>
                     </DataGridTemplateColumn.CellTemplate>
 
@@ -350,7 +342,6 @@
                                       ItemsSource="{Binding DataContext.RoleModels, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                       SelectedValuePath="Guid"
                                       Tag="{Binding}"
-                                      SelectionChanged="MulitCbUnit_SelectionChanged"
                                       VirtualizingPanel.IsVirtualizing="False"
                                       Loaded="CBMultiRole_Loaded">
                                 <ComboBox.ItemTemplate>

+ 0 - 85
UniformMaterialManagementSystem/Views/UsersControl.xaml.cs

@@ -90,64 +90,6 @@ namespace UniformMaterialManagementSystem.Views
             currUser.Company = newCompany;
         }
 
-        private void MulitCbUnit_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            // sender 依旧是 ComboBox
-            var obj = (ComboBox)sender;
-            var comboBox1 = (ComboBox)sender;
-
-            //FilterDataGridTemplateColumn? templeColumn = dataGridUser.Columns[5] as FilterDataGridTemplateColumn;
-            //if (templeColumn == null) { return; }
-            //object item = dataGridUser.CurrentCell.Item;
-            //FrameworkElement element = templeColumn.GetCellContent(item);
-            //if (element == null) { return; }
-            //ComboBox? comboBox1 = templeColumn.CellTemplate.FindName("cbMultiRole", element) as ComboBox;
-            //StackPanel? stackPanel = templeColumn.CellTemplate.FindName("RolePanel", element) as StackPanel; // null
-            //if (comboBox1 == null) { return; }
-            //if (obj == comboBox1) { } // 相等
-
-            // 获取ComboBox ItemTemplate 内的控件
-            var templ1 = comboBox1?.ItemTemplate; // DataTemplate(从这里获取内部控件)
-            var templ2 = comboBox1?.Template; // ControlTemplate
-                                              //var panel1 = templ2?.FindName("RolePanel", comboBox1); // null。这是 ControlTemplate 获取数据的方法
-
-            var currItem = comboBox1?.Items.CurrentItem; // 类型是 Entities.Role
-            var comboBoxItem = comboBox1?.ItemContainerGenerator.ContainerFromItem(currItem); // 类型是 ComboBoxItem
-            if (comboBoxItem == null) { return; }
-
-            // todo ComboBox 的子控件和 ComboBoxItem 的子控件不同?
-            ContentPresenter? myContentPresenter = FindVisualChild<ContentPresenter>(comboBoxItem); // 这里的参数不能换成 ComboBox 控件 得不到想要的结果
-            if (myContentPresenter == null) { return; }
-
-            // 方法二:
-            //DataTemplate myDataTemplate = myContentPresenter.ContentTemplate;
-            //StackPanel panel0 = (StackPanel)myDataTemplate.FindName("RolePanel", myContentPresenter);
-            // 方法一:
-            StackPanel? panel1 = templ1?.FindName("RolePanel", myContentPresenter) as StackPanel; // 跟上面的形式相等
-            if (panel1 == null) { return; }
-
-            var checkBox = panel1?.Children[0] as CheckBox;
-            var textBlock = panel1?.Children[1] as TextBlock;
-
-            bool? isChecked = checkBox?.IsChecked;
-            string? selectedRole = textBlock?.Text;
-
-
-        }
-
-        private void TBMultiRole_Loaded(object sender, RoutedEventArgs e)
-        {
-            // todo 转移到 ViewModel 中
-            var tbMultiRole = sender as TextBlock;
-            if (tbMultiRole == null) { return; }
-            UserModel? currUser = dataGridUser.CurrentCell.Item as UserModel;
-            if (currUser == null) { return; }
-
-            if (currUser.Roles == null || currUser.Roles.Count == 0) { return; }
-            // 设置当前行角色列的显示文本
-            //tbMultiRole.Text = string.Join(";", currUser.Roles.Select(x => x.Description));
-        }
-
         private void CBMultiRole_Loaded(object sender, RoutedEventArgs e)
         {
             var cbMultiRole = sender as ComboBox;
@@ -194,32 +136,5 @@ namespace UniformMaterialManagementSystem.Views
             }
             return child;
         }
-
-        // 弃用
-        private void DataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
-        {
-            // 不用这个事件,用 TextBlock 的 Load 事件
-            //DataGrid? dataGridUser = sender as DataGrid;
-            //if (dataGridUser == null) { return; }
-
-            //FilterDataGridTemplateColumn? templeColumn = dataGridUser.Columns[5] as FilterDataGridTemplateColumn;
-            //if (templeColumn == null) { return; }
-            ////object item = dataGridUser.CurrentCell.Item; // item == user 两种不同的写法
-            //User? user = dataGridUser.SelectedCells[0].Item as User;
-            //FrameworkElement element = templeColumn.GetCellContent(user);
-            //var comboBox2 = templeColumn.CellEditingTemplate.FindName("cbMultiRole", element); // 编辑状态可以获取 ComboBox
-
-            // 退出编辑状态?
-            //DataGridCellInfo currCell = dataGridUser.CurrentCell;
-            //DataGridRow row = (DataGridRow)dataGridUser.ItemContainerGenerator.ContainerFromItem(currCell.Item);
-            //if (row == null) { return; }
-            //DataGridCellsPresenter cellsPresenter = FindVisualChild<DataGridCellsPresenter>(row); // todo 判断方法代码有没有区别
-            //DataGridCell cell = (DataGridCell)cellsPresenter.ItemContainerGenerator.ContainerFromIndex(5); // 列索引 5
-            //cell.IsEditing = false;
-            ////MessageBox.Show("终止编辑?"); // 完成编辑了
-
-            // var textBlock1 = templeColumn.CellTemplate.FindName("tbMultiRole", element); // 报错
-
-        }
     }
 }