6 changed files with 46 additions and 185 deletions
@ -1,96 +0,0 @@ |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Uow; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Event; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; |
|||
|
|||
public class CoatingIssueNoteEventHandler |
|||
: StoreEventHandlerBase |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<CoatingIssueNote>> |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<List<CoatingIssueNote>>> |
|||
, ILocalEventHandler<SfsConfirmedEntityEventData<CoatingIssueNote>> |
|||
{ |
|||
private readonly ICoatingIssueRequestManager _materialRequestManager; |
|||
|
|||
public CoatingIssueNoteEventHandler( |
|||
ICoatingIssueRequestManager materialRequestManager |
|||
) |
|||
{ |
|||
_materialRequestManager = materialRequestManager; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 当叫料记录创建后 修改请求的值
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData<CoatingIssueNote> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
|
|||
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 当叫料记录创建后 修改请求的值
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<CoatingIssueNote> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
if (!entity.UseOnTheWayLocation) |
|||
{ |
|||
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 当叫料记录创建后 修改请求的值
|
|||
/// </summary>
|
|||
/// <param name="eventData"></param>
|
|||
/// <returns></returns>
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<CoatingIssueNote>> eventData) |
|||
{ |
|||
var entities = eventData.Entity; |
|||
foreach (var entity in entities.Where(entity => !entity.UseOnTheWayLocation)) |
|||
{ |
|||
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
private async Task UpdateReceivedQtyMaterialRequestAsync(CoatingIssueNote entity) |
|||
{ |
|||
//var receiveQtyGroup = entity.Details
|
|||
// .GroupBy(p => new { p.ItemCode, p.ToLocationCode })
|
|||
// .Select(p => new { p.Key.ItemCode, p.Key.ToLocationCode, Qty = p.Sum(d => d.Qty) })
|
|||
// .ToList();
|
|||
|
|||
//var materialRequest = await _materialRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false);
|
|||
|
|||
//if (entity.RequestType != EnumMaterialRequestType.Issue_Direct.ToString())
|
|||
//{
|
|||
// //更新叫料请求的已收数量
|
|||
// foreach (var materialRequestDetail in materialRequest.Details)
|
|||
// {
|
|||
// var receiveQty = receiveQtyGroup.FirstOrDefault(p =>
|
|||
// p.ItemCode == materialRequestDetail.ItemCode &&
|
|||
// p.ToLocationCode == materialRequestDetail.ToLocationCode)?.Qty;
|
|||
// if (receiveQty != null)
|
|||
// {
|
|||
// materialRequestDetail.ReceivedQty += receiveQty.Value;
|
|||
// }
|
|||
// }
|
|||
|
|||
|
|||
//}
|
|||
} |
|||
} |
Loading…
Reference in new issue