|
@ -5,7 +5,9 @@ using System.Threading; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
|
using Volo.Abp; |
|
|
using Volo.Abp.Application.Dtos; |
|
|
using Volo.Abp.Application.Dtos; |
|
|
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
using Win_in.Sfs.Wms.Store.Domain; |
|
|
using Win_in.Sfs.Wms.Store.Domain; |
|
@ -28,13 +30,14 @@ public class DeliverNoteAppService : |
|
|
IDeliverNoteAppService |
|
|
IDeliverNoteAppService |
|
|
{ |
|
|
{ |
|
|
private readonly IDeliverNoteManager _deliverNoteManager; |
|
|
private readonly IDeliverNoteManager _deliverNoteManager; |
|
|
|
|
|
private readonly ICustomerItemAppService _customerItemAppService; |
|
|
|
|
|
|
|
|
public DeliverNoteAppService( |
|
|
public DeliverNoteAppService( |
|
|
IDeliverNoteRepository repository, |
|
|
IDeliverNoteRepository repository, |
|
|
IDeliverNoteManager deliverNoteManager |
|
|
IDeliverNoteManager deliverNoteManager, ICustomerItemAppService customerItemAppService) : base(repository) |
|
|
) : base(repository) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_deliverNoteManager = deliverNoteManager; |
|
|
_deliverNoteManager = deliverNoteManager; |
|
|
|
|
|
_customerItemAppService = customerItemAppService; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -49,6 +52,10 @@ public class DeliverNoteAppService : |
|
|
await _deliverNoteManager.CreateAsync(entity).ConfigureAwait(false); |
|
|
await _deliverNoteManager.CreateAsync(entity).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
var dto = ObjectMapper.Map<DeliverNote, DeliverNoteDTO>(entity); |
|
|
var dto = ObjectMapper.Map<DeliverNote, DeliverNoteDTO>(entity); |
|
|
|
|
|
foreach (var detail in dto.Details) |
|
|
|
|
|
{ |
|
|
|
|
|
CheckCustomerItem(detail.ItemCode,dto.CustomerCode); |
|
|
|
|
|
} |
|
|
return dto; |
|
|
return dto; |
|
|
} |
|
|
} |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -63,6 +70,15 @@ public class DeliverNoteAppService : |
|
|
await _deliverNoteManager.CreateManyAsync(entitys).ConfigureAwait(false); |
|
|
await _deliverNoteManager.CreateManyAsync(entitys).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
var dtos = ObjectMapper.Map<List<DeliverNote>, List<DeliverNoteDTO>>(entitys); |
|
|
var dtos = ObjectMapper.Map<List<DeliverNote>, List<DeliverNoteDTO>>(entitys); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var dto in dtos) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var detail in dto.Details) |
|
|
|
|
|
{ |
|
|
|
|
|
CheckCustomerItem(detail.ItemCode, dto.CustomerCode); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return dtos; |
|
|
return dtos; |
|
|
} |
|
|
} |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -161,4 +177,13 @@ public class DeliverNoteAppService : |
|
|
|
|
|
|
|
|
await _repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
await _repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void CheckCustomerItem(string customerCode, string itemCode) |
|
|
|
|
|
{ |
|
|
|
|
|
var dto=_customerItemAppService.GetByCustomerAndItemAsync(itemCode, customerCode); |
|
|
|
|
|
if (dto == null) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new UserFriendlyException($"{customerCode}客户零件号,{itemCode}Erp料号没有客户物品对应关系"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|