|
@ -1,5 +1,9 @@ |
|
|
using System.Collections.Generic; |
|
|
using System; |
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Linq; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using Microsoft.AspNetCore.Components.Forms; |
|
|
|
|
|
using Omu.ValueInjecter; |
|
|
using Volo.Abp.EventBus; |
|
|
using Volo.Abp.EventBus; |
|
|
using Win_in.Sfs.Shared.Event; |
|
|
using Win_in.Sfs.Shared.Event; |
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
@ -14,19 +18,83 @@ public class ProductionReturnRequestEventHandler |
|
|
{ |
|
|
{ |
|
|
private readonly IProductionReturnJobAppService _productionReturnJobApp; |
|
|
private readonly IProductionReturnJobAppService _productionReturnJobApp; |
|
|
|
|
|
|
|
|
|
|
|
private readonly IProductionReturnNoteAppService _productionReturnNoteApp; |
|
|
|
|
|
|
|
|
public ProductionReturnRequestEventHandler( |
|
|
public ProductionReturnRequestEventHandler( |
|
|
IProductionReturnJobAppService productionReturnJobApp |
|
|
IProductionReturnJobAppService productionReturnJobApp, |
|
|
|
|
|
IProductionReturnNoteAppService productionReturnNoteApp |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
|
|
|
_productionReturnNoteApp= productionReturnNoteApp; |
|
|
_productionReturnJobApp = productionReturnJobApp; |
|
|
_productionReturnJobApp = productionReturnJobApp; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<ProductionReturnRequest> eventData) |
|
|
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<ProductionReturnRequest> eventData) |
|
|
{ |
|
|
{ |
|
|
var entity = eventData.Entity; |
|
|
var entity = eventData.Entity; |
|
|
var job = await BuildProductionReturnJobCreateInputAsync(entity).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
await _productionReturnJobApp.CreateAsync(job).ConfigureAwait(false); |
|
|
//CreateMap<ProductionReturnRequest, ProductionReturnNoteEditInput>()
|
|
|
|
|
|
// .ForMember(x => x.JobNumber, y => y.MapFrom(d => d.Number))
|
|
|
|
|
|
// .ForMember(x => x.ReturnTime, y => y.MapFrom(d => d.CreationTime))
|
|
|
|
|
|
// .ForMember(x => x.Worker, y => y.MapFrom(d => d.Worker))
|
|
|
|
|
|
// .ForMember(x => x.ActiveDate, y => y.MapFrom(d => DateTime.Now))
|
|
|
|
|
|
// .Ignore(x => x.Number);
|
|
|
|
|
|
//CreateMap<ProductionReturnRequestDetail, ProductionReturnNoteDetailInput>()
|
|
|
|
|
|
// .ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.FromPackingCode))
|
|
|
|
|
|
// .ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.ToPackingCode))
|
|
|
|
|
|
// .ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.SupplierBatch))
|
|
|
|
|
|
// .ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.ArriveDate))
|
|
|
|
|
|
// .ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.ProduceDate))
|
|
|
|
|
|
// .ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpireDate))
|
|
|
|
|
|
// .ForMember(x => x.FromLot, y => y.MapFrom(d => string.Empty))
|
|
|
|
|
|
// .ForMember(x => x.ToLot, y => y.MapFrom(d => d.ToLot))
|
|
|
|
|
|
// .ForMember(x => x.ToContainerCode, y => y.MapFrom(d => d.ToContainerCode))
|
|
|
|
|
|
// .ForMember(x => x.FromContainerCode, y => y.MapFrom(d => d.FromContainerCode))
|
|
|
|
|
|
// .ForMember(x => x.FromStatus, y => y.MapFrom(d => d.FromStatus))
|
|
|
|
|
|
// .ForMember(x => x.ToStatus, y => y.MapFrom(d => d.ToStatus))
|
|
|
|
|
|
// .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty))
|
|
|
|
|
|
// .ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.FromLocationCode))
|
|
|
|
|
|
// .ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.ToLocationArea))
|
|
|
|
|
|
// .ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.ToLocationGroup))
|
|
|
|
|
|
// .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.ToLocationErpCode))
|
|
|
|
|
|
// .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.ToWarehouseCode))
|
|
|
|
|
|
// .ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty))
|
|
|
|
|
|
// .Ignore(x => x.ArriveDate)
|
|
|
|
|
|
// .Ignore(x => x.ToLocationCode)
|
|
|
|
|
|
// .Ignore(x => x.ToLocationArea)
|
|
|
|
|
|
// .Ignore(x => x.ToLocationGroup)
|
|
|
|
|
|
// .Ignore(x => x.ToLocationErpCode)
|
|
|
|
|
|
// .Ignore(x => x.ToWarehouseCode)
|
|
|
|
|
|
// .Ignore(x => x.HandledContainerCode)
|
|
|
|
|
|
// .Ignore(x => x.HandledPackingCode)
|
|
|
|
|
|
// .Ignore(x => x.HandledToLocationCode)
|
|
|
|
|
|
// .Ignore(x => x.HandledToLocationArea)
|
|
|
|
|
|
// .Ignore(x => x.HandledToLocationGroup)
|
|
|
|
|
|
// .Ignore(x => x.HandledToLocationErpCode)
|
|
|
|
|
|
// .Ignore(x => x.HandledToWarehouseCode)
|
|
|
|
|
|
// .Ignore(x => x.HandledExpireDate)
|
|
|
|
|
|
// .Ignore(x => x.HandledLot)
|
|
|
|
|
|
// .Ignore(x => x.HandledArriveDate)
|
|
|
|
|
|
// .Ignore(x => x.HandledProduceDate)
|
|
|
|
|
|
// .Ignore(x => x.HandledQty)
|
|
|
|
|
|
// .Ignore(x => x.HandledSupplierBatch);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProductionReturnNoteEditInput input = new ProductionReturnNoteEditInput(); |
|
|
|
|
|
input.InjectFrom(entity); |
|
|
|
|
|
input.ReturnTime = DateTime.Now; |
|
|
|
|
|
input.ActiveDate=DateTime.Now; |
|
|
|
|
|
input.JobNumber = input.Number; |
|
|
|
|
|
List<ProductionReturnNoteDetailInput> inputdetail = new List<ProductionReturnNoteDetailInput>(); |
|
|
|
|
|
foreach (var itm in entity.Details) |
|
|
|
|
|
{ |
|
|
|
|
|
ProductionReturnNoteDetailInput detail=new ProductionReturnNoteDetailInput(); |
|
|
|
|
|
detail.InjectFrom(itm); |
|
|
|
|
|
inputdetail.Add(detail); |
|
|
|
|
|
} |
|
|
|
|
|
input.Details = inputdetail.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
await _productionReturnNoteApp.CreateAsync(input).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<ProductionReturnRequest> eventData) |
|
|
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<ProductionReturnRequest> eventData) |
|
@ -36,26 +104,13 @@ public class ProductionReturnRequestEventHandler |
|
|
await _productionReturnJobApp.CancelByProductionReturnRequestNumberAsync(entity.Number).ConfigureAwait(false); |
|
|
await _productionReturnJobApp.CancelByProductionReturnRequestNumberAsync(entity.Number).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task<ProductionReturnJobEditInput> BuildProductionReturnJobCreateInputAsync(ProductionReturnRequest request) |
|
|
//private PurchaseReturnNoteEditInput BuildProductionReturn(PurchaseReturnJob entity)
|
|
|
{ |
|
|
//{
|
|
|
var job = ObjectMapper.Map<ProductionReturnRequest, ProductionReturnJobEditInput>(request); |
|
|
// var input = ObjectMapper.Map<PurchaseReturnJob, PurchaseReturnNoteEditInput>(entity);
|
|
|
|
|
|
|
|
|
job.Details = new List<ProductionReturnJobDetailInput>(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var detail in request.Details) |
|
|
// input.Details.RemoveAll(p => p.Qty == 0);
|
|
|
{ |
|
|
|
|
|
var inputDetail = |
|
|
|
|
|
ObjectMapper.Map<ProductionReturnRequestDetail, ProductionReturnJobDetailInput>(detail); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return input;
|
|
|
var location = await LocationAclService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); |
|
|
//}
|
|
|
|
|
|
|
|
|
job.WorkGroupCode = location.WorkGroupCode; |
|
|
|
|
|
|
|
|
|
|
|
job.Details.Add(inputDetail); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return job; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|