Browse Source

更新

dev_DY_CC
周红军 1 year ago
parent
commit
c7a637a7fe
  1. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Bases/SfsBaseDataAppServiceBase.cs
  2. 27
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAppService.cs
  3. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAutoMapperProfile.cs

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Bases/SfsBaseDataAppServiceBase.cs

@ -27,6 +27,7 @@ public abstract class SfsBaseDataAppServiceBase<TEntity, TEntityDto, TRequestInp
{
protected IItemBasicAppService ItemBasicAppService => LazyServiceProvider.LazyGetRequiredService<IItemBasicAppService>();
protected ILocationAppService LocationAppService => LazyServiceProvider.LazyGetRequiredService<ILocationAppService>();
protected IErpLocationAppService ErpLocationAppService => LazyServiceProvider.LazyGetRequiredService<IErpLocationAppService>();
protected IWarehouseAppService WarehouseAppService => LazyServiceProvider.LazyGetRequiredService<IWarehouseAppService>();
protected ISupplierAppService SupplierAppService => LazyServiceProvider.LazyGetRequiredService<ISupplierAppService>();
protected IAreaAppService AreaAppService => LazyServiceProvider.LazyGetRequiredService<IAreaAppService>();

27
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAppService.cs

@ -10,6 +10,7 @@ using Volo.Abp;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Basedata.Domain.Shared;
@ -40,6 +41,32 @@ public class ErpLocationItemAppService
_manager = manager;
}
/// <summary>
/// 用来重写 新增实体
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("")]
[UnitOfWork]
public override async Task<ErpLocationItemDTO> CreateAsync(ErpLocationItemEditInput input)
{
var itemBasic = await ItemBasicAppService.GetByCodeAsync(input.ItemCode).ConfigureAwait(false);
Check.NotNull(itemBasic, "物品代码", $"物品 {input.ItemCode} 不存在");
var erpLocation = await ErpLocationAppService.GetByCodeAsync(input.ErpLocationCode).ConfigureAwait(false);
Check.NotNull(erpLocation, "储位代码", $"储位 {input.ErpLocationCode} 不存在");
var entity = await _repository.FirstOrDefaultAsync(p => p.ItemCode == input.ItemCode && p.ErpLocationCode == input.ErpLocationCode).ConfigureAwait(false);
if(entity != null)
{
throw new UserFriendlyException($"物品{input.ItemCode}和储位{input.ErpLocationCode} 对应关系已存在");
}
return await base.CreateAsync(input).ConfigureAwait(false);
}
/// <summary>
/// 检查物料和储位对应关系是否存在
/// </summary>

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ErpLocationItems/ErpLocationItemAutoMapperProfile.cs

@ -14,6 +14,7 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
CreateMap<ErpLocationItemImportInput, ErpLocationItem>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.Remark)
.Ignore(x => x.TenantId)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.ConcurrencyStamp)

Loading…
Cancel
Save