|
@ -5,6 +5,7 @@ using System.Threading.Tasks; |
|
|
using Microsoft.AspNetCore.Components.Forms; |
|
|
using Microsoft.AspNetCore.Components.Forms; |
|
|
using Omu.ValueInjecter; |
|
|
using Omu.ValueInjecter; |
|
|
using Volo.Abp.EventBus; |
|
|
using Volo.Abp.EventBus; |
|
|
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
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; |
|
|
using Win_in.Sfs.Wms.Store.Domain; |
|
|
using Win_in.Sfs.Wms.Store.Domain; |
|
@ -33,68 +34,65 @@ public class ProductionReturnRequestEventHandler |
|
|
{ |
|
|
{ |
|
|
var entity = eventData.Entity; |
|
|
var entity = eventData.Entity; |
|
|
|
|
|
|
|
|
//CreateMap<ProductionReturnRequest, ProductionReturnNoteEditInput>()
|
|
|
if (entity.DirectCreateNote) |
|
|
// .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(); |
|
|
ProductionReturnNoteEditInput input = new ProductionReturnNoteEditInput(); |
|
|
detail.InjectFrom(itm); |
|
|
input.InjectFrom(entity); |
|
|
inputdetail.Add(detail); |
|
|
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); |
|
|
} |
|
|
} |
|
|
input.Details = inputdetail.ToList(); |
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
ProductionReturnJobEditInput input = new ProductionReturnJobEditInput(); |
|
|
|
|
|
input.InjectFrom(entity); |
|
|
|
|
|
input.ProductionReturnRequestNumber = entity.Number; |
|
|
|
|
|
input.JobType = EnumJobType.ProductionReturnJob; |
|
|
|
|
|
input.JobStatus = EnumJobStatus.Open; |
|
|
|
|
|
input.IsAutoComplete = entity.AutoCompleteJob; |
|
|
|
|
|
List<ProductionReturnJobDetailInput> inputdetail = new List<ProductionReturnJobDetailInput>(); |
|
|
|
|
|
foreach (var itm in entity.Details) |
|
|
|
|
|
{ |
|
|
|
|
|
ProductionReturnJobDetailInput detail = new ProductionReturnJobDetailInput(); |
|
|
|
|
|
detail.InjectFrom(itm); |
|
|
|
|
|
|
|
|
await _productionReturnNoteApp.CreateAsync(input).ConfigureAwait(false); |
|
|
detail.RecommendToLocationArea = itm.ToLocationArea; |
|
|
|
|
|
detail.RecommendToLocationCode = itm.ToLocationCode; |
|
|
|
|
|
detail.RecommendToLocationErpCode = itm.ToLocationErpCode; |
|
|
|
|
|
detail.RecommendToLocationGroup = itm.ToLocationGroup; |
|
|
|
|
|
detail.RecommendToWarehouseCode = itm.ToWarehouseCode; |
|
|
|
|
|
detail.RecommendLot = itm.ToLot; |
|
|
|
|
|
detail.RecommendPackingCode = itm.ToPackingCode; |
|
|
|
|
|
detail.RecommendQty = itm.Qty; |
|
|
|
|
|
|
|
|
|
|
|
detail.HandledToLocationArea = itm.ToLocationArea; |
|
|
|
|
|
detail.HandledToLocationCode = itm.ToLocationCode; |
|
|
|
|
|
detail.HandledToLocationErpCode = itm.ToLocationErpCode; |
|
|
|
|
|
detail.HandledToLocationGroup = itm.ToLocationGroup; |
|
|
|
|
|
detail.HandledToWarehouseCode = itm.ToWarehouseCode; |
|
|
|
|
|
detail.HandledLot = itm.ToLot; |
|
|
|
|
|
detail.HandledPackingCode = itm.ToPackingCode; |
|
|
|
|
|
detail.HandledQty = itm.Qty; |
|
|
|
|
|
detail.StdPackQty = itm.StdPackQty; |
|
|
|
|
|
detail.Status = itm.ToStatus; |
|
|
|
|
|
inputdetail.Add(detail); |
|
|
|
|
|
} |
|
|
|
|
|
input.Details = inputdetail.ToList(); |
|
|
|
|
|
input.WarehouseCode = entity.Details.Count > 0 ? entity.Details[0].ToWarehouseCode : " "; |
|
|
|
|
|
//插入任务
|
|
|
|
|
|
await _productionReturnJobApp.CreateAsync(input).ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
|
|
|
entity.Complete(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<ProductionReturnRequest> eventData) |
|
|
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<ProductionReturnRequest> eventData) |
|
|