diff --git a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterAuditedEntityBaseDto.cs b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterAuditedEntityBaseDto.cs index 6c75575db..79318d483 100644 --- a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterAuditedEntityBaseDto.cs +++ b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterAuditedEntityBaseDto.cs @@ -3,7 +3,8 @@ using Volo.Abp.Application.Dtos; namespace WinIn.FasterZ.Wms.AppBase.FasterBaseDto; -public class FasterAuditedEntityBaseDto : AuditedEntityDto +[Serializable] +public class FasterAuditedEntityBaseDto : AuditedEntityDto { - public string ConcurrencyStamp { get; set; } + public string ConcurrencyStamp { get; set; } = string.Empty; } \ No newline at end of file diff --git a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterCreateUpdateBaseDto.cs b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterCreateUpdateBaseDto.cs index 2975d0363..4b0edef03 100644 --- a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterCreateUpdateBaseDto.cs +++ b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterCreateUpdateBaseDto.cs @@ -6,5 +6,5 @@ public class FasterCreateUpdateBaseDto { public Guid Id { get; set; } - public string ConcurrencyStamp { get; set; } + public string ConcurrencyStamp { get; set; } = string.Empty; } \ No newline at end of file diff --git a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/CreateUpdateStoreWorkOrderDto.cs b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/CreateUpdateStoreWorkOrderDto.cs index 1e1cbf8b6..bf3c580e4 100644 --- a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/CreateUpdateStoreWorkOrderDto.cs +++ b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/CreateUpdateStoreWorkOrderDto.cs @@ -1,5 +1,5 @@ using System; -using WinIn.FasterZ.Wms.AppBase.CreateUpdateBaseDto; +using WinIn.FasterZ.Wms.AppBase.FasterBaseDto; namespace WinIn.FasterZ.Wms.Z_Business.StoreWorkOrder.Dtos; @@ -10,7 +10,7 @@ using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail; using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail.Dtos; [Serializable] -public class CreateUpdateStoreWorkOrderDto: CreateUpdateBaseDto +public class CreateUpdateStoreWorkOrderDto: FasterCreateUpdateBaseDto { public DateTime ActiveDate { get; set; } diff --git a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/StoreWorkOrderDto.cs b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/StoreWorkOrderDto.cs index e5b6fba80..81a49ae05 100644 --- a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/StoreWorkOrderDto.cs +++ b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/StoreWorkOrderDto.cs @@ -1,51 +1,46 @@ using System; -using Volo.Abp.Application.Dtos; +using System.Collections.Generic; using WinIn.FasterZ.Wms.AppBase.FasterBaseDto; using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail.Dtos; namespace WinIn.FasterZ.Wms.Z_Business.StoreWorkOrder.Dtos; -using System.Collections.Generic; - -using WinIn.FasterZ.Wms.Permissions; -using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail; - [Serializable] public class StoreWorkOrderDto : FasterAuditedEntityBaseDto { - public DateTime ActiveDate { get; set; } + public DateTime ActiveDate { get; set; } - public DateTime EffectiveDate { get; set; } + public DateTime EffectiveDate { get; set; } - public string ItemCode { get; set; } + public string ItemCode { get; set; } - public string? ItemDesc1 { get; set; } + public string? ItemDesc1 { get; set; } - public string? ItemDesc2 { get; set; } + public string? ItemDesc2 { get; set; } - public string? ItemName { get; set; } + public string? ItemName { get; set; } - public string? LocationCode { get; set; } + public string? LocationCode { get; set; } - public string Number { get; set; } + public string Number { get; set; } - public string? Op { get; set; } + public string? Op { get; set; } - public decimal Qty { get; set; } + public decimal Qty { get; set; } - public string? Remark { get; set; } + public string? Remark { get; set; } - public List Details {get;set;} =new (); + public List Details { get; set; } = new(); - public string Type { get; set; } + public string Type { get; set; } - public string Uom { get; set; } + public string Uom { get; set; } - public string? Worker { get; set; } + public string? Worker { get; set; } - public string? WorkOrderId { get; set; } + public string? WorkOrderId { get; set; } - public string? WorkStation { get; set; } + public string? WorkStation { get; set; } - public string WoStatus { get; set; } + public string WoStatus { get; set; } } \ No newline at end of file diff --git a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/CreateUpdateStoreWorkOrderDetailDto.cs b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/CreateUpdateStoreWorkOrderDetailDto.cs index 0b3f0ac64..8956c51ed 100644 --- a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/CreateUpdateStoreWorkOrderDetailDto.cs +++ b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/CreateUpdateStoreWorkOrderDetailDto.cs @@ -1,13 +1,13 @@ using System; +using WinIn.FasterZ.Wms.AppBase.FasterBaseDto; using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrder.Dtos; namespace WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail.Dtos; -using WinIn.FasterZ.Wms.AppBase.CreateUpdateBaseDto; using WinIn.FasterZ.Wms.Permissions; [Serializable] -public class CreateUpdateStoreWorkOrderDetailDto: CreateUpdateBaseDto +public class CreateUpdateStoreWorkOrderDetailDto: FasterCreateUpdateBaseDto { public DateTime EffectiveDate { get; set; } diff --git a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/StoreWorkOrderDetailDto.cs b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/StoreWorkOrderDetailDto.cs index 21b50910e..05bda1fe4 100644 --- a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/StoreWorkOrderDetailDto.cs +++ b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/StoreWorkOrderDetailDto.cs @@ -1,38 +1,32 @@ using System; -using Volo.Abp.Application.Dtos; -using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrder.Dtos; +using WinIn.FasterZ.Wms.AppBase.FasterBaseDto; namespace WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail.Dtos; -using WinIn.FasterZ.Wms.Permissions; -using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrder; - [Serializable] -public class StoreWorkOrderDetailDto : AuditedEntityDto +public class StoreWorkOrderDetailDto : FasterAuditedEntityBaseDto { - public DateTime EffectiveDate { get; set; } - - public string ItemCode { get; set; } + public DateTime EffectiveDate { get; set; } - public string? ItemDesc1 { get; set; } + public string ItemCode { get; set; } - public string? ItemDesc2 { get; set; } + public string? ItemDesc1 { get; set; } - public string? ItemName { get; set; } + public string? ItemDesc2 { get; set; } - + public string? ItemName { get; set; } - public Guid MasterId { get; set; } + public Guid MasterId { get; set; } - public string Number { get; set; } + public string Number { get; set; } - public string? Op { get; set; } + public string? Op { get; set; } - public string? RawLocationCode { get; set; } + public string? RawLocationCode { get; set; } - public decimal RawQty { get; set; } + public decimal RawQty { get; set; } - public string? RawUom { get; set; } + public string? RawUom { get; set; } - public string? Remark { get; set; } + public string? Remark { get; set; } } \ No newline at end of file diff --git a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application/AppBase/ZbxBase.cs b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application/AppBase/ZbxBase.cs index e2c81efd1..667d25c55 100644 --- a/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application/AppBase/ZbxBase.cs +++ b/WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application/AppBase/ZbxBase.cs @@ -11,6 +11,7 @@ using AutoMapper; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Localization; using NPOI.SS.UserModel; @@ -56,7 +57,6 @@ public class ZbxBase Cache => LazyServiceProvider.LazyGetRequiredService>(); - private IMapper _mapper; #endregion @@ -205,17 +205,18 @@ public class ZbxBase /// [HttpPut("api/[controller]/base/update-by-id")] - public new async Task UpdateAsync(TKey id, TEntityDto input) + public new async Task UpdateAsync(TKey id, TUpdateInput input) { //return base.UpdateAsync(id, input); - await CheckUpdatePolicyAsync().ConfigureAwait(false); - var entity = await GetEntityByIdAsync(id).ConfigureAwait(false); - + await CheckUpdatePolicyAsync().ConfigureAwait(true); + var entity = await GetEntityByIdAsync(id).ConfigureAwait(true); + var entity2 = input!.ToObject(); Type t1 = null; Type t2 = null; + Type t3 = typeof(TUpdateInput); #region 给所有字表的 Id和MasterId赋值 否则默认的会是000000-000-....的id 插入时会报错 @@ -224,10 +225,10 @@ public class ZbxBase)) + && propertyInfo.PropertyType.IsGenericType + && propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(List<>)) { - var listProperty = typeof(TEntityDto).GetProperty("Details"); + var listProperty = typeof(TUpdateInput).GetProperty("Details"); if (listProperty != null) { t1 = listProperty.PropertyType.GetGenericArguments()[0]; @@ -247,7 +248,7 @@ public class ZbxBase x.State == EntityState.Modified || x.State == EntityState.Added).Select(x => x.Entity).ToList(); - foreach (var item in modity) - { - item?.GetType().GetProperty("ConcurrencyStamp")?.SetValue(item, Guid.NewGuid().ToString()); - } - return base.SaveChanges(); + //this.ChangeTracker.DetectChanges(); + //var modity = this.ChangeTracker.Entries().Where(x => x.State == EntityState.Modified || x.State == EntityState.Added).Select(x => x.Entity).ToList(); + //foreach (var item in modity) + //{ + // item?.GetType().GetProperty("ConcurrencyStamp")?.SetValue(item, Guid.NewGuid().ToString()); + //} + //return base.SaveChanges(); + return 1; } public override Task SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = new CancellationToken()) { - this.ChangeTracker.DetectChanges(); - var modity = this.ChangeTracker.Entries().Where(x => x.State == EntityState.Modified || x.State == EntityState.Added).Select(x => x.Entity).ToList(); - foreach (var item in modity) - { - item?.GetType().GetProperty("ConcurrencyStamp")?.SetValue(item, Guid.NewGuid().ToString()); - } - return base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken); + //this.ChangeTracker.DetectChanges(); + //var modity = this.ChangeTracker.Entries().Where(x => x.State == EntityState.Modified || x.State == EntityState.Added).Select(x => x.Entity).ToList(); + //foreach (var item in modity) + //{ + // item?.GetType().GetProperty("ConcurrencyStamp")?.SetValue(item, Guid.NewGuid().ToString()); + //} + //return base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken); + return Task.FromResult(1); } public override Task SaveChangesOnDbContextAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = new CancellationToken()) { - this.ChangeTracker.DetectChanges(); - var modity = this.ChangeTracker.Entries().Where(x => x.State == EntityState.Modified || x.State == EntityState.Added).Select(x => x.Entity).ToList(); - foreach (var item in modity) - { - item?.GetType().GetProperty("ConcurrencyStamp")?.SetValue(item, Guid.NewGuid().ToString()); - } - return base.SaveChangesOnDbContextAsync(acceptAllChangesOnSuccess, cancellationToken); + //this.ChangeTracker.DetectChanges(); + //var modity = this.ChangeTracker.Entries().Where(x => x.State == EntityState.Modified || x.State == EntityState.Added).Select(x => x.Entity).ToList(); + //foreach (var item in modity) + //{ + // item?.GetType().GetProperty("ConcurrencyStamp")?.SetValue(item, Guid.NewGuid().ToString()); + //} + //return base.SaveChangesOnDbContextAsync(acceptAllChangesOnSuccess, cancellationToken); + return Task.FromResult(1); } } }