Browse Source

修改 自动提交

集成Redis
郑渤旭[Irelia] 2 years ago
parent
commit
eb7df9a732
  1. 9
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Job/EnumJobStatus.cs
  2. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsJobAppServiceBase.cs
  3. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobManager.cs
  4. 140
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs
  5. 56
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs
  6. 45
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductRecycleRequestEventHandler.cs
  7. 53
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedIssueRequestEventHandler.cs
  8. 57
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedReceiptRequestEventHandler.cs

9
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Job/EnumJobStatus.cs

@ -1,3 +1,6 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Shared.Domain.Shared;
public enum EnumJobStatus public enum EnumJobStatus
@ -5,30 +8,36 @@ public enum EnumJobStatus
/// <summary> /// <summary>
/// 空枚举 /// 空枚举
/// </summary> /// </summary>
[Display(Name = "空枚举")]
None = 0, None = 0,
/// <summary> /// <summary>
/// 待处理 /// 待处理
/// </summary> /// </summary>
[Display(Name = "待处理")]
Open = 1, Open = 1,
/// <summary> /// <summary>
/// 执行中 /// 执行中
/// </summary> /// </summary>
[Display(Name = "执行中")]
Doing = 2, Doing = 2,
/// <summary> /// <summary>
/// 完成 /// 完成
/// </summary> /// </summary>
[Display(Name = "完成")]
Done = 3, Done = 3,
/// <summary> /// <summary>
/// 关闭 /// 关闭
/// </summary> /// </summary>
[Display(Name = "关闭")]
Closed = 8, Closed = 8,
/// <summary> /// <summary>
/// 作废 /// 作废
/// </summary> /// </summary>
[Display(Name = "作废")]
Cancelled = 9 Cancelled = 9
} }

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsJobAppServiceBase.cs

@ -11,6 +11,7 @@ using Volo.Abp.Validation;
using Win_in.Sfs.Shared.Application; using Win_in.Sfs.Shared.Application;
using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
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;
@ -153,6 +154,12 @@ public abstract class SfsJobAppServiceBase<TEntity, TDetail, TEntityDto, TReques
public virtual async Task<TEntityDto> CompleteAsync(Guid id, TEntityDto dto) public virtual async Task<TEntityDto> CompleteAsync(Guid id, TEntityDto dto)
{ {
var handleEntity = ObjectMapper.Map<TEntityDto, TEntity>(dto); var handleEntity = ObjectMapper.Map<TEntityDto, TEntity>(dto);
var job= await _repository.GetAsync(id).ConfigureAwait(false);
if (job.JobStatus is EnumJobStatus.Closed or EnumJobStatus.Cancelled or EnumJobStatus.None or EnumJobStatus.Done)//需要考虑下 多次提交的问题 所以不判断 进行中
{
throw new UserFriendlyException($"任务状态错误:编号为【{job.Number}】的任务已经【{job.JobStatus.GetDisplayName()}】");
}
var handleResult = await _jobManager.CompleteAsync(handleEntity, CurrentUser).ConfigureAwait(false); var handleResult = await _jobManager.CompleteAsync(handleEntity, CurrentUser).ConfigureAwait(false);
var handleDto = ObjectMapper.Map<TEntity, TEntityDto>(handleResult); var handleDto = ObjectMapper.Map<TEntity, TEntityDto>(handleResult);
return handleDto; return handleDto;

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobManager.cs

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Users; using Volo.Abp.Users;
using Volo.Abp.Validation; using Volo.Abp.Validation;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
@ -31,9 +32,7 @@ public class PurchaseReceiptJobManager : SfsJobManagerBase<PurchaseReceiptJob, P
public override async Task<PurchaseReceiptJob> CompleteAsync(PurchaseReceiptJob input, ICurrentUser user) public override async Task<PurchaseReceiptJob> CompleteAsync(PurchaseReceiptJob input, ICurrentUser user)
{ {
var entity = await Repository.FindAsync(input.Id).ConfigureAwait(false); var entity = await Repository.FindAsync(input.Id).ConfigureAwait(false);
BuildDetailHandledAsync(input, entity); BuildDetailHandledAsync(input, entity);
//设置任务为完成 //设置任务为完成
return await base.CompleteAsync(entity, user).ConfigureAwait(false); return await base.CompleteAsync(entity, user).ConfigureAwait(false);
} }

140
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs

@ -9,33 +9,89 @@ using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest;
using Win_in.Sfs.Wms.Store.Application.Contracts;
public class DeliverRequestEventHandler public class DeliverRequestEventHandler
: StoreEventHandlerBase : StoreEventHandlerBase
, ILocalEventHandler<SfsHandledEntityEventData<DeliverRequest>> , ILocalEventHandler<SfsHandledEntityEventData<DeliverRequest>>
, ILocalEventHandler<SfsAbortedEntityEventData<DeliverRequest>> , ILocalEventHandler<SfsAbortedEntityEventData<DeliverRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<DeliverRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<DeliverRequest>>>
{ {
private readonly IDeliverNoteAppService _deliverNoteApp; private readonly IDeliverNoteAppService _deliverNoteApp;
private readonly IDeliverJobAppService _deliverJobApp; private readonly IDeliverJobAppService _deliverJobApp;
private readonly ICustomerAddressAppService _customerAddressApp; private readonly ICustomerAddressAppService _customerAddressApp;
private readonly IDeliverRequestManager _deliverRequestManager;
public DeliverRequestEventHandler( public DeliverRequestEventHandler(
IDeliverJobAppService deliverJobApp IDeliverJobAppService deliverJobApp
, IDeliverNoteAppService deliverNoteApp , IDeliverNoteAppService deliverNoteApp
, ICustomerAddressAppService customerAddressApp , ICustomerAddressAppService customerAddressApp, IDeliverRequestManager deliverRequestManager)
)
{ {
_deliverNoteApp = deliverNoteApp; _deliverNoteApp = deliverNoteApp;
_deliverJobApp = deliverJobApp; _deliverJobApp = deliverJobApp;
_customerAddressApp = customerAddressApp; _customerAddressApp = customerAddressApp;
_deliverRequestManager = deliverRequestManager;
}
/// <summary>
/// 创建后
/// </summary>
/// <param name="eventData">Event data</param>
[UnitOfWork]
public async Task HandleEventAsync(SfsCreatedEntityEventData<DeliverRequest> eventData)
{
var entity = eventData.Entity;
if (entity.AutoSubmit)
{
await _deliverRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
/// <summary>
/// 批量创建后
/// </summary>
/// <param name="eventData">Event data</param>
[UnitOfWork]
public async Task HandleEventAsync(SfsCreatedEntityEventData<List<DeliverRequest>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
if (entity.AutoSubmit)
{
await _deliverRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
} }
/// <summary>
/// 审批后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<DeliverRequest> eventData)
{
var entity = eventData.Entity;
//东阳特殊逻辑
if (!entity.DirectCreateNote)
{
await _deliverJobApp.CancelByDeliverRequestAsync(entity.Number).ConfigureAwait(false);
}
}
/// <summary>
/// 执行后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork] [UnitOfWork]
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<DeliverRequest> eventData) public virtual async Task HandleEventAsync(SfsHandledEntityEventData<DeliverRequest> eventData)
{ {
@ -54,26 +110,32 @@ public class DeliverRequestEventHandler
} }
} }
#region 私有
private async Task<DeliverNoteEditInput> BuildDeliverNoteAsync(DeliverRequest request) private async Task<DeliverNoteEditInput> BuildDeliverNoteAsync(DeliverRequest request)
{ {
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.None).ConfigureAwait(false); var transactionType = await TransactionTypeAclService
.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.None).ConfigureAwait(false);
if (request.DeliverRequestType == EnumDeliverRequestType.Normal) if (request.DeliverRequestType == EnumDeliverRequestType.Normal)
{ {
transactionType = await TransactionTypeAclService.GetByTransTypeAsync( transactionType = await TransactionTypeAclService.GetByTransTypeAsync(
EnumTransType.Deliver, EnumTransType.Deliver,
EnumTransSubType.Deliver_Standard).ConfigureAwait(false); EnumTransSubType.Deliver_Standard).ConfigureAwait(false);
} }
else if (request.DeliverRequestType == EnumDeliverRequestType.FIS) else if (request.DeliverRequestType == EnumDeliverRequestType.FIS)
{ {
transactionType = await TransactionTypeAclService.GetByTransTypeAsync( transactionType = await TransactionTypeAclService.GetByTransTypeAsync(
EnumTransType.Deliver, EnumTransType.Deliver,
EnumTransSubType.Deliver_FIS).ConfigureAwait(false); EnumTransSubType.Deliver_FIS).ConfigureAwait(false);
} }
var createInput = ObjectMapper.Map<DeliverRequest, DeliverNoteEditInput>(request); var createInput = ObjectMapper.Map<DeliverRequest, DeliverNoteEditInput>(request);
var customerAddress = (await _customerAddressApp.GetByCustomerCodeAsync(request.CustomerCode).ConfigureAwait(false)).FirstOrDefault(); var customerAddress =
(await _customerAddressApp.GetByCustomerCodeAsync(request.CustomerCode).ConfigureAwait(false))
.FirstOrDefault();
LocationDTO toLocation = null; LocationDTO toLocation = null;
if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode)) if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode))
@ -88,14 +150,14 @@ public class DeliverRequestEventHandler
foreach (var detail in request.Details) foreach (var detail in request.Details)
{ {
var balances = await BalanceAclService.GetRecommendBalancesAsync( var balances = await BalanceAclService.GetRecommendBalancesAsync(
new RecommendBalanceRequestInput() new RecommendBalanceRequestInput
{ {
ItemCode = detail.ItemCode, ItemCode = detail.ItemCode,
Qty = detail.Qty, Qty = detail.Qty,
LocationTypes = transactionType.OutLocationTypes, LocationTypes = transactionType.OutLocationTypes,
LocationAreas = new List<string>() { detail.AreaCode }, LocationAreas = new List<string> { detail.AreaCode },
Statuses = transactionType.OutInventoryStatuses Statuses = transactionType.OutInventoryStatuses
}).ConfigureAwait(false); }).ConfigureAwait(false);
var sumQty = balances.Sum(t => t.Qty); var sumQty = balances.Sum(t => t.Qty);
@ -150,9 +212,12 @@ public class DeliverRequestEventHandler
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, transSubType).ConfigureAwait(false); var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, transSubType)
.ConfigureAwait(false);
var createInput = ObjectMapper.Map<DeliverRequest, DeliverJobEditInput>(request); var createInput = ObjectMapper.Map<DeliverRequest, DeliverJobEditInput>(request);
var customerAddress = (await _customerAddressApp.GetByCustomerCodeAsync(request.CustomerCode).ConfigureAwait(false)).FirstOrDefault(); var customerAddress =
(await _customerAddressApp.GetByCustomerCodeAsync(request.CustomerCode).ConfigureAwait(false))
.FirstOrDefault();
LocationDTO toLocation = null; LocationDTO toLocation = null;
if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode)) if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode))
{ {
@ -165,14 +230,14 @@ public class DeliverRequestEventHandler
foreach (var detail in request.Details) foreach (var detail in request.Details)
{ {
var balances = await BalanceAclService.GetRecommendBalancesAsync( var balances = await BalanceAclService.GetRecommendBalancesAsync(
new RecommendBalanceRequestInput() new RecommendBalanceRequestInput
{ {
ItemCode = detail.ItemCode, ItemCode = detail.ItemCode,
Qty = detail.Qty, Qty = detail.Qty,
LocationTypes = transactionType.OutLocationTypes, LocationTypes = transactionType.OutLocationTypes,
LocationAreas = new List<string>() { detail.AreaCode }, LocationAreas = new List<string> { detail.AreaCode },
Statuses = transactionType.OutInventoryStatuses Statuses = transactionType.OutInventoryStatuses
}).ConfigureAwait(false); }).ConfigureAwait(false);
var sumQty = balances.Sum(t => t.Qty); var sumQty = balances.Sum(t => t.Qty);
@ -190,6 +255,7 @@ public class DeliverRequestEventHandler
inputDetail.ToLocationErpCode = toLocation.ErpLocationCode; inputDetail.ToLocationErpCode = toLocation.ErpLocationCode;
inputDetail.ToWarehouseCode = toLocation.WarehouseCode; inputDetail.ToWarehouseCode = toLocation.WarehouseCode;
} }
var item = await ItemBasicAclService.GetByCodeAsync(balance.ItemCode).ConfigureAwait(false); var item = await ItemBasicAclService.GetByCodeAsync(balance.ItemCode).ConfigureAwait(false);
if (item != null) if (item != null)
@ -214,18 +280,8 @@ public class DeliverRequestEventHandler
createInput.Priority = PriorityHelper.GetPriority(Clock); createInput.Priority = PriorityHelper.GetPriority(Clock);
createInput.PriorityIncrement = 1; createInput.PriorityIncrement = 1;
return new List<DeliverJobEditInput>() { createInput }; return new List<DeliverJobEditInput> { createInput };
} }
[UnitOfWork] #endregion
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<DeliverRequest> eventData)
{
var entity = eventData.Entity;
//东阳特殊逻辑
if (!entity.DirectCreateNote)
{
await _deliverJobApp.CancelByDeliverRequestAsync(entity.Number).ConfigureAwait(false);
}
}
} }

56
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs

@ -6,6 +6,8 @@ using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Domain.Shared; 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.Domain; using Win_in.Sfs.Wms.Store.Domain;
using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings;
using MaterialRequest = Win_in.Sfs.Wms.Store.Domain.MaterialRequest;
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest;
@ -37,33 +39,6 @@ public class IssueNoteEventHandler
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false);
} }
private async Task UpdateReceivedQtyMaterialRequestAsync(IssueNote 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;
}
}
await _materialRequestManager.UpdateDetailsAsync(materialRequest).ConfigureAwait(false);
}
}
/// <summary> /// <summary>
/// 当叫料记录创建后 修改请求的值 /// 当叫料记录创建后 修改请求的值
/// </summary> /// </summary>
@ -93,4 +68,31 @@ public class IssueNoteEventHandler
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false);
} }
} }
private async Task UpdateReceivedQtyMaterialRequestAsync(IssueNote 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;
}
}
await _materialRequestManager.UpdateDetailsAsync(materialRequest).ConfigureAwait(false);
}
}
} }

45
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductRecycleRequestEventHandler.cs

@ -16,20 +16,55 @@ using Application.Contracts;
public class ProductRecycleRequestEventHandler public class ProductRecycleRequestEventHandler
: StoreEventHandlerBase : StoreEventHandlerBase
, ILocalEventHandler<SfsHandledEntityEventData<ProductRecycleRequest>> , ILocalEventHandler<SfsHandledEntityEventData<ProductRecycleRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<ProductRecycleRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<ProductRecycleRequest>>>
{ {
private readonly IProductRecycleNoteAppService _productRecycleNoteApp; private readonly IProductRecycleNoteAppService _productRecycleNoteApp;
private readonly IBackFlushNoteAppService _backFlushNoteApp; private readonly IBackFlushNoteAppService _backFlushNoteApp;
private readonly IBomAppService _bomApp; private readonly IBomAppService _bomApp;
private readonly IProductRecycleRequestManager _productRecycleRequestManager;
public ProductRecycleRequestEventHandler( public ProductRecycleRequestEventHandler(
IProductRecycleNoteAppService productRecycleNoteApp, IProductRecycleNoteAppService productRecycleNoteApp,
IBackFlushNoteAppService backFlushNoteApp, IBackFlushNoteAppService backFlushNoteApp,
IBomAppService bomApp IBomAppService bomApp, IProductRecycleRequestManager
) productRecycleRequestManager)
{ {
_productRecycleNoteApp = productRecycleNoteApp; _productRecycleNoteApp = productRecycleNoteApp;
_backFlushNoteApp = backFlushNoteApp; _backFlushNoteApp = backFlushNoteApp;
_bomApp = bomApp; _bomApp = bomApp;
_productRecycleRequestManager = productRecycleRequestManager;
}
/// <summary>
/// 创建后
/// </summary>
/// <param name="eventData">Event data</param>
[UnitOfWork]
public async Task HandleEventAsync(SfsCreatedEntityEventData<ProductRecycleRequest> eventData)
{
var entity = eventData.Entity;
if (entity.AutoSubmit)
{
await _productRecycleRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
/// <summary>
/// 批量创建后
/// </summary>
/// <param name="eventData">Event data</param>
[UnitOfWork]
public async Task HandleEventAsync(SfsCreatedEntityEventData<List<ProductRecycleRequest>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
if (entity.AutoSubmit)
{
await _productRecycleRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
} }
[UnitOfWork] [UnitOfWork]
@ -49,6 +84,8 @@ public class ProductRecycleRequestEventHandler
} }
} }
#region 私有
private async Task<ProductRecycleNoteEditInput> BuildProductRecycleNoteAsync(ProductRecycleRequest request) private async Task<ProductRecycleNoteEditInput> BuildProductRecycleNoteAsync(ProductRecycleRequest request)
{ {
var createInput = ObjectMapper.Map<ProductRecycleRequest, ProductRecycleNoteEditInput>(request); var createInput = ObjectMapper.Map<ProductRecycleRequest, ProductRecycleNoteEditInput>(request);
@ -115,6 +152,10 @@ public class ProductRecycleRequestEventHandler
return detailInput; return detailInput;
} }
#endregion
/* /*
private async Task<List<BackFlushNoteCreateInput>> BuildFlushNotesAsync(ProductRecycleRequest request) private async Task<List<BackFlushNoteCreateInput>> BuildFlushNotesAsync(ProductRecycleRequest request)
{ {

53
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedIssueRequestEventHandler.cs

@ -10,20 +10,58 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest;
public class UnplannedIssueRequestEventHandler public class UnplannedIssueRequestEventHandler
: StoreEventHandlerBase : StoreEventHandlerBase
, ILocalEventHandler<SfsHandledEntityEventData<UnplannedIssueRequest>> , ILocalEventHandler<SfsCreatedEntityEventData<UnplannedIssueRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<UnplannedIssueRequest>>>
, ILocalEventHandler<SfsHandledEntityEventData<UnplannedIssueRequest>>
{ {
private readonly IUnplannedIssueJobAppService _unplannedIssueJobApp; private readonly IUnplannedIssueJobAppService _unplannedIssueJobApp;
private readonly IUnplannedIssueNoteAppService _unplannedIssueNoteAppService; private readonly IUnplannedIssueNoteAppService _unplannedIssueNoteAppService;
private readonly IUnplannedIssueRequestManager _unplannedIssueRequestManager;
public UnplannedIssueRequestEventHandler( public UnplannedIssueRequestEventHandler(
IUnplannedIssueJobAppService unplannedIssueJobApp IUnplannedIssueJobAppService unplannedIssueJobApp,
, IUnplannedIssueNoteAppService unplannedIssueNoteAppService IUnplannedIssueNoteAppService unplannedIssueNoteAppService,
) IUnplannedIssueRequestManager unplannedIssueRequestManager)
{ {
_unplannedIssueJobApp = unplannedIssueJobApp; _unplannedIssueJobApp = unplannedIssueJobApp;
_unplannedIssueNoteAppService = unplannedIssueNoteAppService; _unplannedIssueNoteAppService = unplannedIssueNoteAppService;
_unplannedIssueRequestManager = unplannedIssueRequestManager;
} }
/// <summary>
/// 创建后
/// </summary>
/// <param name="eventData">Event data</param>
public async Task HandleEventAsync(SfsCreatedEntityEventData<UnplannedIssueRequest> eventData)
{
var entity = eventData.Entity;
if (entity.AutoSubmit)
{
await _unplannedIssueRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
/// <summary>
/// 批量创建后
/// </summary>
/// <param name="eventData">Event data</param>
public async Task HandleEventAsync(SfsCreatedEntityEventData<List<UnplannedIssueRequest>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
if (entity.AutoSubmit)
{
await _unplannedIssueRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
}
/// <summary>
/// 执行后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<UnplannedIssueRequest> eventData) public virtual async Task HandleEventAsync(SfsHandledEntityEventData<UnplannedIssueRequest> eventData)
{ {
var entity = eventData.Entity; var entity = eventData.Entity;
@ -39,7 +77,10 @@ public class UnplannedIssueRequestEventHandler
} }
} }
private async Task<UnplannedIssueNoteEditInput> BuildUnplannedIssueNoteCreateInputAsync(UnplannedIssueRequest entity) #region 私有
private async Task<UnplannedIssueNoteEditInput> BuildUnplannedIssueNoteCreateInputAsync(
UnplannedIssueRequest entity)
{ {
await Task.CompletedTask.ConfigureAwait(false); await Task.CompletedTask.ConfigureAwait(false);
var createInput = ObjectMapper.Map<UnplannedIssueRequest, UnplannedIssueNoteEditInput>(entity); var createInput = ObjectMapper.Map<UnplannedIssueRequest, UnplannedIssueNoteEditInput>(entity);
@ -50,6 +91,8 @@ public class UnplannedIssueRequestEventHandler
return createInput; return createInput;
} }
#endregion
private async Task<UnplannedIssueJobEditInput> BuildUnplannedIssueJobCreateInputAsync(UnplannedIssueRequest entity) private async Task<UnplannedIssueJobEditInput> BuildUnplannedIssueJobCreateInputAsync(UnplannedIssueRequest entity)
{ {
await Task.CompletedTask.ConfigureAwait(false); await Task.CompletedTask.ConfigureAwait(false);

57
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedReceiptRequestEventHandler.cs

@ -10,20 +10,58 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest;
public class UnplannedReceiptRequestEventHandler public class UnplannedReceiptRequestEventHandler
: StoreEventHandlerBase : StoreEventHandlerBase
, ILocalEventHandler<SfsHandledEntityEventData<UnplannedReceiptRequest>> , ILocalEventHandler<SfsCreatedEntityEventData<UnplannedReceiptRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<UnplannedReceiptRequest>>>
, ILocalEventHandler<SfsHandledEntityEventData<UnplannedReceiptRequest>>
{ {
private readonly IUnplannedReceiptJobAppService _unplannedReceiptJobApp; private readonly IUnplannedReceiptJobAppService _unplannedReceiptJobApp;
private readonly IUnplannedReceiptNoteAppService _unplannedReceiptNoteApp; private readonly IUnplannedReceiptNoteAppService _unplannedReceiptNoteApp;
private readonly IUnplannedReceiptRequestManager _unplannedReceiptRequestManager;
public UnplannedReceiptRequestEventHandler( public UnplannedReceiptRequestEventHandler(
IUnplannedReceiptJobAppService unplannedReceiptJobApp IUnplannedReceiptJobAppService unplannedReceiptJobApp,
, IUnplannedReceiptNoteAppService unplannedReceiptNoteApp IUnplannedReceiptNoteAppService unplannedReceiptNoteApp,
) IUnplannedReceiptRequestManager unplannedReceiptRequestManager)
{ {
_unplannedReceiptNoteApp = unplannedReceiptNoteApp; _unplannedReceiptNoteApp = unplannedReceiptNoteApp;
_unplannedReceiptRequestManager = unplannedReceiptRequestManager;
_unplannedReceiptJobApp = unplannedReceiptJobApp; _unplannedReceiptJobApp = unplannedReceiptJobApp;
} }
/// <summary>
/// 创建后
/// </summary>
/// <param name="eventData">Event data</param>
public async Task HandleEventAsync(SfsCreatedEntityEventData<UnplannedReceiptRequest> eventData)
{
var entity = eventData.Entity;
if (entity.AutoSubmit)
{
await _unplannedReceiptRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
/// <summary>
/// 批量创建后
/// </summary>
/// <param name="eventData">Event data</param>
public async Task HandleEventAsync(SfsCreatedEntityEventData<List<UnplannedReceiptRequest>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
if (entity.AutoSubmit)
{
await _unplannedReceiptRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
}
/// <summary>
/// 执行后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<UnplannedReceiptRequest> eventData) public virtual async Task HandleEventAsync(SfsHandledEntityEventData<UnplannedReceiptRequest> eventData)
{ {
var entity = eventData.Entity; var entity = eventData.Entity;
@ -41,7 +79,10 @@ public class UnplannedReceiptRequestEventHandler
} }
} }
private async Task<UnplannedReceiptNoteEditInput> BuildUnplannedReceiptNoteCreateInputAsync(UnplannedReceiptRequest entity) #region 私有
private async Task<UnplannedReceiptNoteEditInput> BuildUnplannedReceiptNoteCreateInputAsync(
UnplannedReceiptRequest entity)
{ {
await Task.CompletedTask.ConfigureAwait(false); await Task.CompletedTask.ConfigureAwait(false);
var createInput = ObjectMapper.Map<UnplannedReceiptRequest, UnplannedReceiptNoteEditInput>(entity); var createInput = ObjectMapper.Map<UnplannedReceiptRequest, UnplannedReceiptNoteEditInput>(entity);
@ -52,7 +93,8 @@ public class UnplannedReceiptRequestEventHandler
return createInput; return createInput;
} }
private async Task<UnplannedReceiptJobEditInput> BuildToUnplannedReceiptJobCreateInputAsync(UnplannedReceiptRequest entity) private async Task<UnplannedReceiptJobEditInput> BuildToUnplannedReceiptJobCreateInputAsync(
UnplannedReceiptRequest entity)
{ {
await Task.CompletedTask.ConfigureAwait(false); await Task.CompletedTask.ConfigureAwait(false);
var createInput = ObjectMapper.Map<UnplannedReceiptRequest, UnplannedReceiptJobEditInput>(entity); var createInput = ObjectMapper.Map<UnplannedReceiptRequest, UnplannedReceiptJobEditInput>(entity);
@ -75,6 +117,8 @@ public class UnplannedReceiptRequestEventHandler
return createInput; return createInput;
} }
#endregion
/* AutoMapper实现 /* AutoMapper实现
private void SetUnplannedReceiptJobDetails(UnplannedReceiptJobCreateInput createInput, List<UnplannedReceiptRequestDetail> details) private void SetUnplannedReceiptJobDetails(UnplannedReceiptJobCreateInput createInput, List<UnplannedReceiptRequestDetail> details)
{ {
@ -111,5 +155,4 @@ public class UnplannedReceiptRequestEventHandler
} }
} }
*/ */
} }

Loading…
Cancel
Save