|
@ -26,13 +26,18 @@ public class PutawayNoteAppService : |
|
|
IPutawayNoteAppService |
|
|
IPutawayNoteAppService |
|
|
{ |
|
|
{ |
|
|
private readonly IPutawayNoteManager _putawayNoteManager; |
|
|
private readonly IPutawayNoteManager _putawayNoteManager; |
|
|
|
|
|
private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteAppService; |
|
|
|
|
|
public readonly IInspectJobAppService _inspectJobAppService; |
|
|
|
|
|
|
|
|
public PutawayNoteAppService( |
|
|
public PutawayNoteAppService( |
|
|
IPutawayNoteRepository repository, |
|
|
IPutawayNoteRepository repository, |
|
|
IPutawayNoteManager putawayNoteManager |
|
|
IPutawayNoteManager putawayNoteManager, |
|
|
) : base(repository) |
|
|
IPurchaseReceiptNoteAppService purchaseReceiptNoteAppService, |
|
|
|
|
|
IInspectJobAppService inspectJobAppService) : base(repository) |
|
|
{ |
|
|
{ |
|
|
_putawayNoteManager = putawayNoteManager; |
|
|
_putawayNoteManager = putawayNoteManager; |
|
|
|
|
|
_purchaseReceiptNoteAppService = purchaseReceiptNoteAppService; |
|
|
|
|
|
_inspectJobAppService = inspectJobAppService; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -44,6 +49,19 @@ public class PutawayNoteAppService : |
|
|
//[Authorize(PutawayNotePermissions.Create)]
|
|
|
//[Authorize(PutawayNotePermissions.Create)]
|
|
|
public override async Task<PutawayNoteDTO> CreateAsync(PutawayNoteEditInput input) |
|
|
public override async Task<PutawayNoteDTO> CreateAsync(PutawayNoteEditInput input) |
|
|
{ |
|
|
{ |
|
|
|
|
|
foreach (var detail in input.Details) |
|
|
|
|
|
{ |
|
|
|
|
|
var purchasereDetail =await _purchaseReceiptNoteAppService.GetDetailByItemAndPackingAsync(detail.ItemCode, detail.ToPackingCode).ConfigureAwait(false); |
|
|
|
|
|
if (purchasereDetail != null) |
|
|
|
|
|
{ |
|
|
|
|
|
var inspectJobDto =await _inspectJobAppService.GetInspectNoteDetailByPackingCodeAsync(detail.ToPackingCode).ConfigureAwait(false); |
|
|
|
|
|
if (inspectJobDto.JobStatus != EnumJobStatus.Done) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new UserFriendlyException($"包含【{detail.ToPackingCode}】箱码的报检单,尚未完成质检"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var entity = ObjectMapper.Map<PutawayNoteEditInput, PutawayNote>(input); |
|
|
var entity = ObjectMapper.Map<PutawayNoteEditInput, PutawayNote>(input); |
|
|
var result = await _putawayNoteManager.CreateByPurchaseAsync(entity).ConfigureAwait(false); |
|
|
var result = await _putawayNoteManager.CreateByPurchaseAsync(entity).ConfigureAwait(false); |
|
|
|
|
|
|
|
|