|
|
@ -46,6 +46,15 @@ public class ProductionReturnNoteAppService : |
|
|
|
//[Authorize(ProductionReturnNotePermissions.Create)]
|
|
|
|
public override async Task<ProductionReturnNoteDTO> CreateAsync(ProductionReturnNoteEditInput input) |
|
|
|
{ |
|
|
|
//校验物料和库存关系
|
|
|
|
foreach (var item in input.Details) |
|
|
|
{ |
|
|
|
var obj = await _itemStoreRelationAppService.GetFirstAsync(item.ItemCode, item.ToLocationCode).ConfigureAwait(false); |
|
|
|
if (obj == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"物料{item.ItemCode}不能存在目标库位{item.ToLocationCode},物料库存关系表不存在!"); |
|
|
|
} |
|
|
|
} |
|
|
|
var entity = ObjectMapper.Map<ProductionReturnNoteEditInput, ProductionReturnNote>(input); |
|
|
|
await _ProductionReturnNoteManager.CreateAsync(entity).ConfigureAwait(false); |
|
|
|
var dto = ObjectMapper.Map<ProductionReturnNote, ProductionReturnNoteDTO>(entity); |
|
|
|