采购订单添加物料功能
This commit is contained in:
@@ -16,9 +16,6 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class MaterialService : CrudAppService<MaterialEntity, MaterialGetListOutput, long, MaterialCreateUpdateInput>, IMaterialService
|
||||
{
|
||||
public MaterialService(IRepository<MaterialEntity> repository, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
}
|
||||
public async Task<PageModel<List<MaterialGetListOutput>>> PageListAsync(MaterialCreateUpdateInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
|
||||
@@ -16,9 +16,6 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class PurchaseDetailsService : CrudAppService<PurchaseDetailsEntity, PurchaseDetailsGetListOutput, long, PurchaseDetailsCreateUpdateInput>, IPurchaseDetailsService
|
||||
{
|
||||
public PurchaseDetailsService(IRepository<PurchaseDetailsEntity> repository, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
}
|
||||
public async Task<PageModel<List<PurchaseDetailsGetListOutput>>> PageListAsync(PurchaseDetailsCreateUpdateInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
|
||||
@@ -5,9 +5,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Attribute;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.ERP.Purchase;
|
||||
using Yi.Framework.Interface.ERP;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
using Yi.Framework.Repository;
|
||||
using Yi.Framework.Service.Base.Crud;
|
||||
@@ -16,10 +18,10 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class PurchaseService : CrudAppService<PurchaseEntity, PurchaseGetListOutput, long, PurchaseCreateInput, PurchaseUpdateInput>, IPurchaseService
|
||||
{
|
||||
private readonly ISugarUnitOfWork<UnitOfWork> _unitOfWork;
|
||||
private ISugarUnitOfWork<UnitOfWork> _unitOfWork;
|
||||
private readonly IPurchaseDetailsService _purchaseDetailsService;
|
||||
public PurchaseService(IRepository<PurchaseEntity> repository, IMapper mapper, ISugarUnitOfWork<UnitOfWork> unitOfWork,
|
||||
IPurchaseDetailsService purchaseDetailsService) : base(repository, mapper)
|
||||
public PurchaseService(ISugarUnitOfWork<UnitOfWork> unitOfWork,
|
||||
IPurchaseDetailsService purchaseDetailsService)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
_purchaseDetailsService = purchaseDetailsService;
|
||||
@@ -36,20 +38,20 @@ namespace Yi.Framework.Service.ERP
|
||||
|
||||
public override async Task<PurchaseGetListOutput> CreateAsync(PurchaseCreateInput input)
|
||||
{
|
||||
|
||||
PurchaseEntity entity = null;
|
||||
using (var uow = _unitOfWork.CreateContext())
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
entity = await MapToEntityAsync(input);
|
||||
entity.PaidMoney = 0;
|
||||
entity.TotalMoney = input.PurchaseDetails.Sum(u => u.UnitPrice * u.TotalNumber);
|
||||
entity.PurchaseState = PurchaseStateEnum.Build;
|
||||
TryToSetTenantId(entity);
|
||||
var purchaseId = await Repository.InsertReturnSnowflakeIdAsync(entity);
|
||||
|
||||
entity.Id = purchaseId;
|
||||
await _purchaseDetailsService.CreateAsync(input.PurchaseDetails);
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
return null;
|
||||
return await MapToGetListOutputDtoAsync(entity); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class SupplierService : CrudAppService<SupplierEntity, SupplierGetListOutput, long, SupplierCreateUpdateInput>, ISupplierService
|
||||
{
|
||||
public SupplierService(IRepository<SupplierEntity> repository, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
}
|
||||
public async Task<PageModel<List<SupplierGetListOutput>>> PageListAsync(SupplierCreateUpdateInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
|
||||
@@ -16,9 +16,6 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class UnitService : CrudAppService<UnitEntity, UnitGetListOutput, long, UnitCreateUpdateInput>, IUnitService
|
||||
{
|
||||
public UnitService(IRepository<UnitEntity> repository, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
}
|
||||
public async Task<PageModel<List<UnitGetListOutput>>> PageListAsync(UnitCreateUpdateInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
|
||||
@@ -16,9 +16,6 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class WarehouseService : CrudAppService<WarehouseEntity, WarehouseGetListOutput, long, WarehouseCreateUpdateInput>, IWarehouseService
|
||||
{
|
||||
public WarehouseService(IRepository<WarehouseEntity> repository, IMapper mapper) : base(repository, mapper)
|
||||
{
|
||||
}
|
||||
public async Task<PageModel<List<WarehouseGetListOutput>>> PageListAsync(WarehouseCreateUpdateInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
|
||||
Reference in New Issue
Block a user