Compare commits

...

4 Commits

  1. 8
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/CreateUpdateBaseDto/CreateUpdateBaseDto.cs
  2. 10
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterAuditedEntityBaseDto.cs
  3. 10
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterCreateUpdateBaseDto.cs
  4. 3
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/CreateUpdateStoreWorkOrderDto.cs
  5. 46
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/StoreWorkOrderDto.cs
  6. 3
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/CreateUpdateStoreWorkOrderDetailDto.cs
  7. 34
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/StoreWorkOrderDetailDto.cs
  8. 199
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application/AppBase/ZbxBase.cs
  9. 40
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application/Z_Business/StoreSaleOrder/StoreSaleOrderAppService.cs
  10. 79
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.EntityFrameworkCore/EntityFrameworkCore/WmsDbContext.cs
  11. 2
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.EntityFrameworkCore/Z_Business/StoreWorkOrder/StoreWorkOrderEfCoreQueryableExtensions.cs
  12. 2
      WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.HttpApi.Host/appsettings.json

8
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/CreateUpdateBaseDto/CreateUpdateBaseDto.cs

@ -1,8 +0,0 @@
using System;
using Volo.Abp.Application.Dtos;
namespace WinIn.FasterZ.Wms.AppBase.CreateUpdateBaseDto;
public class CreateUpdateBaseDto : EntityDto<Guid>
{
}

10
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterAuditedEntityBaseDto.cs

@ -0,0 +1,10 @@
using System;
using Volo.Abp.Application.Dtos;
namespace WinIn.FasterZ.Wms.AppBase.FasterBaseDto;
[Serializable]
public class FasterAuditedEntityBaseDto<TPrimaryKey> : AuditedEntityDto<TPrimaryKey>
{
public string ConcurrencyStamp { get; set; } = string.Empty;
}

10
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/AppBase/FasterBaseDto/FasterCreateUpdateBaseDto.cs

@ -0,0 +1,10 @@
using System;
namespace WinIn.FasterZ.Wms.AppBase.FasterBaseDto;
public class FasterCreateUpdateBaseDto
{
public Guid Id { get; set; }
public string ConcurrencyStamp { get; set; } = string.Empty;
}

3
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/CreateUpdateStoreWorkOrderDto.cs

@ -1,4 +1,5 @@
using System;
using WinIn.FasterZ.Wms.AppBase.FasterBaseDto;
namespace WinIn.FasterZ.Wms.Z_Business.StoreWorkOrder.Dtos;
@ -9,7 +10,7 @@ using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail;
using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail.Dtos;
[Serializable]
public class CreateUpdateStoreWorkOrderDto
public class CreateUpdateStoreWorkOrderDto: FasterCreateUpdateBaseDto
{
public DateTime ActiveDate { get; set; }

46
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrder/Dtos/StoreWorkOrderDto.cs

@ -1,50 +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 : AuditedEntityDto<Guid>
public class StoreWorkOrderDto : FasterAuditedEntityBaseDto<Guid>
{
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<StoreWorkOrderDetailDto> Details {get;set;} =new ();
public List<StoreWorkOrderDetailDto> 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; }
}

3
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application.Contracts/Z_Business/StoreWorkOrderDetail/Dtos/CreateUpdateStoreWorkOrderDetailDto.cs

@ -1,4 +1,5 @@
using System;
using WinIn.FasterZ.Wms.AppBase.FasterBaseDto;
using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrder.Dtos;
namespace WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail.Dtos;
@ -6,7 +7,7 @@ namespace WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail.Dtos;
using WinIn.FasterZ.Wms.Permissions;
[Serializable]
public class CreateUpdateStoreWorkOrderDetailDto
public class CreateUpdateStoreWorkOrderDetailDto: FasterCreateUpdateBaseDto
{
public DateTime EffectiveDate { get; set; }

34
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<Guid>
public class StoreWorkOrderDetailDto : FasterAuditedEntityBaseDto<Guid>
{
public DateTime EffectiveDate { get; set; }
public string ItemCode { get; set; }
public string? ItemDesc1 { get; set; }
public DateTime EffectiveDate { get; set; }
public string? ItemDesc2 { get; set; }
public string ItemCode { get; set; }
public string? ItemName { get; set; }
public string? ItemDesc1 { 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; }
}

199
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application/AppBase/ZbxBase.cs

@ -1,33 +1,27 @@
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Identity;
namespace WinIn.FasterZ.Wms.AppBase;
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Localization;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Domain.Repositories;
using WinIn.FasterZ.Store.AppBase;
using WinIn.FasterZ.Store.AppBase.Filters;
using WinIn.FasterZ.Store.AppBase.TableColumnTypeDto;
using WinIn.FasterZ.Store.Enums;
@ -35,6 +29,8 @@ using WinIn.FasterZ.Wms.AppBase.Extensions;
using WinIn.FasterZ.Wms.AppBaseBusiness.ExportCustomUserSetting;
using WinIn.FasterZ.Wms.Localization;
namespace WinIn.FasterZ.Wms.AppBase;
public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto, TCreateInput, TUpdateInput> :
CrudAppService<TEntity, TEntityDto, TKey,
TPagedAndSortedResultRequestDto, TCreateInput, TUpdateInput>,
@ -42,19 +38,33 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{
#region 定义
/// <summary>
/// redis缓存时间 分钟
/// </summary>
private const int CacheMinute = 30;
private readonly IRepository<TEntity, TKey> _repository;
protected IStringLocalizer<WmsResource> Localizer =>
private IMapper _mapper;
private IStringLocalizer<WmsResource> Localizer =>
LazyServiceProvider.LazyGetRequiredService<IStringLocalizer<WmsResource>>();
protected ExportCustomUserSettingAppService ExportCustomUserSettingAppService =>
private ExportCustomUserSettingAppService ExportCustomUserSettingAppService =>
LazyServiceProvider.LazyGetRequiredService<ExportCustomUserSettingAppService>();
private IDistributedCache<TEntity> Cache =>
LazyServiceProvider.LazyGetRequiredService<IDistributedCache<TEntity>>();
#endregion
/// <summary>
/// 构造方法
/// 构造方法
/// </summary>
/// <param name="repository"></param>
public ZbxBase(IRepository<TEntity, TKey> repository) : base(repository)
protected ZbxBase(IRepository<TEntity, TKey> repository) : base(repository)
{
_repository = repository;
}
@ -118,8 +128,8 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
{
//判断是否是List集合
if (propertyInfo.Name == "Details"
&& propertyInfo.PropertyType.IsGenericType
&& propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(List<>))
&& propertyInfo.PropertyType.IsGenericType
&& propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(List<>))
{
var listProperty = typeof(TEntity).GetProperty("Details");
@ -172,6 +182,7 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
TryToSetTenantId(entity);
await Repository.InsertAsync(entity, true);
return await MapToGetOutputDtoAsync(entity);
}
@ -193,75 +204,81 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
/// <param name="input"></param>
/// <returns></returns>
[HttpPut("api/[controller]/base/update-by-id")]
public override async Task<TEntityDto> UpdateAsync(TKey id, TUpdateInput input)
public new async Task<TEntityDto> UpdateAsync(TKey id, TUpdateInput input)
{
//return base.UpdateAsync(id, input);
await CheckUpdatePolicyAsync().ConfigureAwait(false);
var entity = await GetEntityByIdAsync(id).ConfigureAwait(false);
entity.FromObject(input!);
await CheckUpdatePolicyAsync().ConfigureAwait(true);
var entity = await GetEntityByIdAsync(id).ConfigureAwait(true);
if (entity.GetType().GetProperty("ConcurrencyStamp").GetValue(entity).ToString() !=
input.GetType().GetProperty("ConcurrencyStamp").GetValue(input).ToString())
{
throw new UserFriendlyException($"您操作的数据已经被修改:\r\n" +
$"已经由【{Newtonsoft.Json.JsonConvert.SerializeObject(entity)}】\r\n" +
$"变更为【{Newtonsoft.Json.JsonConvert.SerializeObject(input)}】\r\n");
}
Type inputDetailDtoType = null;
Type entityDetailType = null;
bool inputDetailDtoTypeFlag = false;
bool entityDetailTypeFlag = false;
#region 给所有字表的 Id和MasterId赋值 否则默认的会是000000-000-....的id 插入时会报错
var t3 = typeof(TUpdateInput);
var propertyInfos = entity.GetType().GetProperties();
foreach (var propertyInfo in propertyInfos)
var entityProperties = entity.GetType().GetProperties();
var inputProperties = input.GetType().GetProperties();
//InputDto的
foreach (var propertyInfo in inputProperties)
{
//判断是否是List集合
if (propertyInfo.Name == "Details"
&& propertyInfo.PropertyType.IsGenericType
&& propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(List<>))
&& propertyInfo.PropertyType.IsGenericType
&& propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(List<>))
{
var listProperty = typeof(TEntity).GetProperty("Details");
// 获取 List 的元素类型
var listProperty = typeof(TUpdateInput).GetProperty("Details");
if (listProperty != null)
{
var listItemType = listProperty.PropertyType.GetGenericArguments()[0];
// 获取元素类型的 ID 属性
var detailIdProperty = listItemType.GetProperty("Id");
var masterIdProperty = listItemType.GetProperty("MasterId");
if (detailIdProperty != null)
{
// 获取 List 属性的值
var list = (IList)listProperty.GetValue(entity);
// 遍历 List 集合中的每个元素,给 ID 属性赋值
if (list != null)
{
foreach (var item in list)
{
if ((Guid)detailIdProperty.GetValue(item)! == Guid.Empty)
{
detailIdProperty.SetValue(item, Guid.NewGuid());
}
}
}
}
inputDetailDtoType = listProperty.PropertyType.GetGenericArguments()[0];
inputDetailDtoTypeFlag = true;
}
}
}
if (masterIdProperty != null)
if (inputDetailDtoTypeFlag == true)
{
//实体的
foreach (var propertyInfo in entityProperties)
{
//判断是否是List集合
if (propertyInfo.Name == "Details"
&& propertyInfo.PropertyType.IsGenericType
&& propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(List<>))
{
var listProperty = typeof(TEntity).GetProperty("Details");
// 获取 List 的元素类型
if (listProperty != null)
{
// 获取 List 属性的值
var list = (IList)listProperty.GetValue(entity);
// 遍历 List 集合中的每个元素,给 ID 属性赋值
if (list != null)
{
foreach (var item in list)
{
masterIdProperty.SetValue(item, id);
}
}
entityDetailType = listProperty.PropertyType.GetGenericArguments()[0];
entityDetailTypeFlag = true;
}
}
}
}
#endregion
if (inputDetailDtoTypeFlag == true && entityDetailTypeFlag==true)
{
var config = new MapperConfiguration(cfg =>
{
// 动态创建映射关系
cfg.CreateMap(typeof(TEntityDto), typeof(TEntity));
cfg.CreateMap(typeof(TUpdateInput), typeof(TEntity));
cfg.CreateMap(inputDetailDtoType, entityDetailType);
});
_mapper = new Mapper(config);
}
await ReMoveCaCheAsync(id).ConfigureAwait(false);
await Repository.UpdateAsync(entity, true);
return await MapToGetOutputDtoAsync(entity);
}
@ -456,7 +473,7 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
for (var i = 0; i < mainProperties.Length + splitDetailsColumnNumber + detailProperties.Length; i++)
{
var colWidth = Math.Max(sheet.GetColumnWidth(i) + 150, 265 * 15);
if (colWidth > 255 * 256)//excel列有最大宽度限制
if (colWidth > 255 * 256) //excel列有最大宽度限制
{
colWidth = 6000;
}
@ -470,7 +487,7 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
for (var i = 0; i < mainProperties.Length; i++)
{
var colWidth = Math.Max(sheet.GetColumnWidth(i) + 150, 265 * 15);
if (colWidth > 255 * 256)//excel列有最大宽度限制
if (colWidth > 255 * 256) //excel列有最大宽度限制
{
colWidth = 6000;
}
@ -516,10 +533,34 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
return tableColumnTypeDtos;
}
/// <summary>
/// 【基础】-【获取 增 改 查基础的Dto数据类型】
/// </summary>
/// <returns></returns>
[HttpPost("api/[controller]/base/get-cache-by-id/{id}")]
public virtual async Task<TEntityDto> GetCacheByIdAsync(TKey id)
{
var entity = await Cache.GetOrAddAsync(
$"{typeof(TEntityDto).Name}:{id}".ToString(),
async () => await GetEntityByIdAsync(id), GetCacheTime);
var dto = ObjectMapper.Map<TEntity, TEntityDto>(entity!);
return dto;
}
#endregion
#region 私有处理
/// <summary>
/// 清楚缓存
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
private async Task ReMoveCaCheAsync(TKey id)
{
await Cache.RemoveAsync(id?.ToString());
}
/// <summary>
/// 按表达式条件获取分页列表
/// </summary>
@ -565,7 +606,7 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
var createTimePropertyInfo = typeof(TEntity).GetProperty(nameof(AuditedEntity.CreationTime));
if (createTimePropertyInfo != null)
{
entities = entities.OrderBy(nameof(AuditedEntity.CreationTime) +" DESC");
entities = entities.OrderBy(nameof(AuditedEntity.CreationTime) + " DESC");
}
else
{
@ -653,6 +694,22 @@ public class ZbxBase<TEntity, TEntityDto, TKey, TPagedAndSortedResultRequestDto,
return count;
}
/// <summary>
/// 获取缓存redis时间
/// </summary>
/// <returns></returns>
private static DistributedCacheEntryOptions GetCacheTime()
{
var random = new Random();
//解决雪崩 添加随机缓存时间
var time = CacheMinute + random.Next(10, 30);
return new DistributedCacheEntryOptions
{
AbsoluteExpiration = DateTimeOffset.Now.AddMinutes(time)
};
}
#region Excel导出的样式设置
/// <summary>

40
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.Application/Z_Business/StoreSaleOrder/StoreSaleOrderAppService.cs

@ -1,10 +1,17 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using WinIn.FasterZ.Wms.Permissions;
using WinIn.FasterZ.Wms.Z_Business.StoreSaleOrder.Dtos;
using Volo.Abp.Application.Services;
using WinIn.FasterZ.Wms.AppBase;
using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrder;
using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrder.Dtos;
using Omu.ValueInjecter;
using WinIn.FasterZ.Wms.Z_Business.StoreWorkOrderDetail.Dtos;
namespace WinIn.FasterZ.Wms.Z_Business.StoreSaleOrder;
@ -20,9 +27,38 @@ public class StoreSaleOrderAppService : ZbxBase<StoreSaleOrder, StoreSaleOrderDt
private readonly IStoreSaleOrderRepository _repository;
public StoreSaleOrderAppService(IStoreSaleOrderRepository repository) : base(repository)
private readonly IStoreWorkOrderAppService _workOrderAppService;
private IMapper _mapperssssss;
public StoreSaleOrderAppService(IStoreSaleOrderRepository repository, IStoreWorkOrderAppService workOrderAppService) : base(repository)
{
_repository = repository;
_repository = repository;
_workOrderAppService = workOrderAppService;
}
/// <summary>
/// 测试多次修改 不 该数据已经被修改错误
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("xcvxcv")]
public async Task test(CreateUpdateStoreWorkOrderDto dto)
{
await _workOrderAppService.UpdateAsync(dto.Id, dto);
var tttt =await _workOrderAppService.GetAsync(dto.Id);
tttt.Qty += 5;
var config = new MapperConfiguration(cfg =>
{
// 动态创建映射关系
cfg.CreateMap(typeof(StoreWorkOrderDto), typeof(CreateUpdateStoreWorkOrderDto));
cfg.CreateMap(typeof(StoreWorkOrderDetailDto), typeof(CreateUpdateStoreWorkOrderDetailDto));
});
_mapperssssss = new AutoMapper.Mapper(config);
var ffff = _mapperssssss.Map<StoreWorkOrderDto, CreateUpdateStoreWorkOrderDto>(tttt);
await _workOrderAppService.UpdateAsync(ffff.Id, ffff);
//throw new UserFriendlyException("xzcvxcv");
}
}

79
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.EntityFrameworkCore/EntityFrameworkCore/WmsDbContext.cs

@ -1,3 +1,7 @@
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
@ -970,14 +974,14 @@ namespace WinIn.FasterZ.Wms.EntityFrameworkCore
///
/// </summary>
public DbSet<AuthMenu> AuthMenus { get; set; }
/// <summary>
///
/// </summary>
public DbSet<StoreTransferNote> StoreTransferNotes { get; set; }
/// <summary>
///
/// </summary>
public DbSet<StoreTransferNoteDetail> StoreTransferNoteDetails { get; set; }
/// <summary>
///
/// </summary>
public DbSet<StoreTransferNote> StoreTransferNotes { get; set; }
/// <summary>
///
/// </summary>
public DbSet<StoreTransferNoteDetail> StoreTransferNoteDetails { get; set; }
public WmsDbContext(DbContextOptions<WmsDbContext> options)
: base(options)
@ -1032,6 +1036,7 @@ namespace WinIn.FasterZ.Wms.EntityFrameworkCore
{
b.ToTable(WmsConsts.DbTablePrefix + "Store_WorkOrder", WmsConsts.DbSchema);
b.ConfigureByConvention();
b.Property(e => e.ConcurrencyStamp).IsConcurrencyToken(false);
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterId).IsRequired();
/* Configure more properties here */
@ -3188,24 +3193,58 @@ namespace WinIn.FasterZ.Wms.EntityFrameworkCore
});
builder.Entity<StoreTransferNote>(b =>
{
b.ToTable(WmsConsts.DbTablePrefix + "Store_TransferNote", WmsConsts.DbSchema, table => table.HasComment(""));
b.ConfigureByConvention();
builder.Entity<StoreTransferNote>(b =>
{
b.ToTable(WmsConsts.DbTablePrefix + "Store_TransferNote", WmsConsts.DbSchema, table => table.HasComment(""));
b.ConfigureByConvention();
/* Configure more properties here */
});
builder.Entity<StoreTransferNoteDetail>(b =>
{
b.ToTable(WmsConsts.DbTablePrefix + "Store_TransferNoteDetail", WmsConsts.DbSchema, table => table.HasComment(""));
b.ConfigureByConvention();
/* Configure more properties here */
});
/* Configure more properties here */
});
}
builder.Entity<StoreTransferNoteDetail>(b =>
{
b.ToTable(WmsConsts.DbTablePrefix + "Store_TransferNoteDetail", WmsConsts.DbSchema, table => table.HasComment(""));
b.ConfigureByConvention();
public override int 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();
}
public override Task<int> 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);
}
/* Configure more properties here */
});
public override Task<int> 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);
}
}
}

2
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.EntityFrameworkCore/Z_Business/StoreWorkOrder/StoreWorkOrderEfCoreQueryableExtensions.cs

@ -13,7 +13,7 @@ public static class StoreWorkOrderEfCoreQueryableExtensions
}
return queryable
// .Include(x => x.xxx) // TODO: AbpHelper generated
.Include(x => x.Details) // TODO: AbpHelper generated
;
}
}

2
WinIn.FasterZ.Wms.Be/WinIn.FasterZ.Wms/WinIn.FasterZ.Wms/src/WinIn.FasterZ.Wms.HttpApi.Host/appsettings.json

@ -15,7 +15,7 @@
"KeyPrefix": "DY_AuthSiteCenter"
},
"AuthServer": {
"Authority": "http://192.168.0.240:60080",
"Authority": "http://dev.ccwin-in.com:60080",
"RequireHttpsMetadata": "false",
"SwaggerClientId": "Wms_Swagger"
},

Loading…
Cancel
Save