|
@ -49,31 +49,32 @@ public class RecycledMaterialReceiptNoteAppService : |
|
|
[HttpPost("")] |
|
|
[HttpPost("")] |
|
|
public override async Task<RecycledMaterialReceiptNoteDTO> CreateAsync(RecycledMaterialReceiptNoteEditInput input) |
|
|
public override async Task<RecycledMaterialReceiptNoteDTO> CreateAsync(RecycledMaterialReceiptNoteEditInput input) |
|
|
{ |
|
|
{ |
|
|
var entity= ObjectMapper.Map<RecycledMaterialReceiptNoteEditInput, RecycledMaterialReceiptNote>(input); |
|
|
var entity = ObjectMapper.Map<RecycledMaterialReceiptNoteEditInput, RecycledMaterialReceiptNote>(input); |
|
|
|
|
|
|
|
|
entity.Number=string.IsNullOrEmpty(input.Number) |
|
|
entity.Number = string.IsNullOrEmpty(input.Number) |
|
|
? await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) |
|
|
? await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) |
|
|
.ConfigureAwait(false) |
|
|
.ConfigureAwait(false) |
|
|
: input.Number; |
|
|
: input.Number; |
|
|
|
|
|
entity.SetId(GuidGenerator.Create()); |
|
|
|
|
|
|
|
|
foreach (var detail in entity.Details) |
|
|
foreach (var detail in entity.Details) |
|
|
{ |
|
|
{ |
|
|
var detailNumber = await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) |
|
|
var detailNumber = await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) |
|
|
.ConfigureAwait(false); |
|
|
.ConfigureAwait(false); |
|
|
detail.Number=detailNumber; |
|
|
detail.SetIdAndNumber(GuidGenerator, entity.Id, detailNumber); |
|
|
var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); |
|
|
var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); |
|
|
detail.LocationErpCode = locationDto.ErpLocationCode; |
|
|
detail.LocationErpCode = locationDto.ErpLocationCode; |
|
|
detail.LocationArea = locationDto.AreaCode; |
|
|
detail.LocationArea = locationDto.AreaCode; |
|
|
detail.LocationGroup = locationDto.LocationGroupCode; |
|
|
detail.LocationGroup = locationDto.LocationGroupCode; |
|
|
detail.WarehouseCode=locationDto.WarehouseCode; |
|
|
detail.WarehouseCode = locationDto.WarehouseCode; |
|
|
var itemBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|
|
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|
|
detail.StdPackQty = itemBasicDto.StdPackQty; |
|
|
detail.StdPackQty = itemBasicDto.StdPackQty; |
|
|
detail.Uom = itemBasicDto.BasicUom; |
|
|
detail.Uom = itemBasicDto.BasicUom; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
entity=await _repository.InsertAsync(entity).ConfigureAwait(false); |
|
|
entity = await _repository.InsertAsync(entity).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<RecycledMaterialReceiptNote>(entity),false).ConfigureAwait(false); |
|
|
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<RecycledMaterialReceiptNote>(entity), false).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
return ObjectMapper.Map<RecycledMaterialReceiptNote, RecycledMaterialReceiptNoteDTO>(entity); |
|
|
return ObjectMapper.Map<RecycledMaterialReceiptNote, RecycledMaterialReceiptNoteDTO>(entity); |
|
|
} |
|
|
} |
|
|