Browse Source

非生领退料修改

master
lvzb 1 year ago
parent
commit
5825d68300
  1. 6
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ItemTransformNoteConverter.cs
  2. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs
  3. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/UnplannedIssueRequestAutoMapperProfile.cs
  4. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Bases/StoreInventoryEventHandlerBase.cs
  5. 65
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedIssueRequestEventHandler.cs
  6. 20
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/UnplannedIssueNoteEventHandler.cs

6
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ItemTransformNoteConverter.cs

@ -5,6 +5,7 @@ using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.ObjectMapping; using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Auth.Application.Contracts; using Win_in.Sfs.Auth.Application.Contracts;
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.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp;
@ -21,6 +22,7 @@ public class ItemTransformNoteConverter : IOutgoingConverter
private readonly ISupplierAsnAppService _supplierAsnAppService; private readonly ISupplierAsnAppService _supplierAsnAppService;
private readonly IDepartmentAppService _departmentAppService; private readonly IDepartmentAppService _departmentAppService;
private readonly IObjectMapper _objectMapper; private readonly IObjectMapper _objectMapper;
private readonly ILocationAppService _locationAppService;
public ItemTransformNoteConverter( public ItemTransformNoteConverter(
IOutgoingFromWmsManager outgoingFromWmsManager IOutgoingFromWmsManager outgoingFromWmsManager
@ -28,6 +30,7 @@ public class ItemTransformNoteConverter : IOutgoingConverter
, ISupplierAsnAppService supplierAsnAppService , ISupplierAsnAppService supplierAsnAppService
, IDepartmentAppService departmentAppService , IDepartmentAppService departmentAppService
, IObjectMapper objectMapper , IObjectMapper objectMapper
, ILocationAppService locationAppService
) )
{ {
_outgoingFromWmsManager = outgoingFromWmsManager; _outgoingFromWmsManager = outgoingFromWmsManager;
@ -35,6 +38,7 @@ public class ItemTransformNoteConverter : IOutgoingConverter
_supplierAsnAppService = supplierAsnAppService; _supplierAsnAppService = supplierAsnAppService;
_departmentAppService = departmentAppService; _departmentAppService = departmentAppService;
_objectMapper = objectMapper; _objectMapper = objectMapper;
_locationAppService = locationAppService;
} }
public virtual async Task<List<OutgoingToExternal>> ConvertAsync() public virtual async Task<List<OutgoingToExternal>> ConvertAsync()
@ -102,6 +106,8 @@ public class ItemTransformNoteConverter : IOutgoingConverter
private CountAdjust BuildIssue(ItemTransformNoteExchangeDto exchangeCountAdjust, string departmentCode) private CountAdjust BuildIssue(ItemTransformNoteExchangeDto exchangeCountAdjust, string departmentCode)
{ {
var detail = exchangeCountAdjust.Detail; var detail = exchangeCountAdjust.Detail;
// _locationAppService.GetListByCodesAndTypesAsync
var counta = new CountAdjust() var counta = new CountAdjust()
{ {
mesout_asd_refc = "MES", mesout_asd_refc = "MES",

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs

@ -5,6 +5,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.Users; using Volo.Abp.Users;
@ -50,6 +51,7 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA
//[Authorize(UnplannedIssueRequestPermissions.Create)] //[Authorize(UnplannedIssueRequestPermissions.Create)]
public override async Task<UnplannedIssueRequestDTO> CreateByOAAsync(UnplannedIssueRequestEditInput input) public override async Task<UnplannedIssueRequestDTO> CreateByOAAsync(UnplannedIssueRequestEditInput input)
{ {
Logger.LogInformation($"DeptNmae【{input.DeptName}】,DeptCode【{input.DeptCode}】");
var entity = ObjectMapper.Map<UnplannedIssueRequestEditInput, UnplannedIssueRequest>(input); var entity = ObjectMapper.Map<UnplannedIssueRequestEditInput, UnplannedIssueRequest>(input);
foreach (var item in entity.Details) foreach (var item in entity.Details)
{ {

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/UnplannedIssueRequestAutoMapperProfile.cs

@ -7,6 +7,7 @@ using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Event; namespace Win_in.Sfs.Wms.Store.Event;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
public partial class StoreEventAutoMapperProfile : Profile public partial class StoreEventAutoMapperProfile : Profile
{ {
@ -66,5 +67,11 @@ public partial class StoreEventAutoMapperProfile : Profile
.Ignore(x => x.ReasonCode) .Ignore(x => x.ReasonCode)
.IgnoreIHasRecommendAndHandledFrom(); .IgnoreIHasRecommendAndHandledFrom();
CreateMap<UnplannedIssueRequestDetail, ExpectOutEditInput>()
.ForMember(x => x.JobNumber, y => y.MapFrom(d => d.Number))
.Ignore(x => x.Worker)
.Ignore(x => x.SerialNumber)
.Ignore(x => x.ExtraProperties);
} }
} }

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Bases/StoreInventoryEventHandlerBase.cs

@ -9,5 +9,5 @@ public abstract class StoreInventoryEventHandlerBase : StoreEventHandlerBase
protected ITransferLogAppService TransferLogAppService => LazyServiceProvider.LazyGetRequiredService<ITransferLogAppService>(); protected ITransferLogAppService TransferLogAppService => LazyServiceProvider.LazyGetRequiredService<ITransferLogAppService>();
protected ITransactionAppService TransactionAppService => LazyServiceProvider.LazyGetRequiredService<ITransactionAppService>(); protected ITransactionAppService TransactionAppService => LazyServiceProvider.LazyGetRequiredService<ITransactionAppService>();
protected IExpectOutAppService ExpectOutAppService => LazyServiceProvider.LazyGetRequiredService<IExpectOutAppService>();
} }

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

@ -1,18 +1,27 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
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.Domain;
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;
using Win_in.Sfs.Wms.Store.Event.Inventories;
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest;
public class UnplannedIssueRequestEventHandler public class UnplannedIssueRequestEventHandler
: StoreEventHandlerBase : StoreExpectInOutEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<UnplannedIssueRequest>> , ILocalEventHandler<SfsCreatedEntityEventData<UnplannedIssueRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<UnplannedIssueRequest>>> , ILocalEventHandler<SfsCreatedEntityEventData<List<UnplannedIssueRequest>>>
, ILocalEventHandler<SfsHandledEntityEventData<UnplannedIssueRequest>> , ILocalEventHandler<SfsHandledEntityEventData<UnplannedIssueRequest>>
, ILocalEventHandler<SfsRefusedEntityEventData<UnplannedIssueRequest>>
, ILocalEventHandler<SfsAbortedEntityEventData<UnplannedIssueRequest>>
, ILocalEventHandler<SfsCancelledEntityEventData<UnplannedIssueRequest>>
{ {
private readonly IUnplannedIssueJobAppService _unplannedIssueJobApp; private readonly IUnplannedIssueJobAppService _unplannedIssueJobApp;
private readonly IUnplannedIssueNoteAppService _unplannedIssueNoteAppService; private readonly IUnplannedIssueNoteAppService _unplannedIssueNoteAppService;
@ -35,6 +44,10 @@ public class UnplannedIssueRequestEventHandler
public async Task HandleEventAsync(SfsCreatedEntityEventData<UnplannedIssueRequest> eventData) public async Task HandleEventAsync(SfsCreatedEntityEventData<UnplannedIssueRequest> eventData)
{ {
var entity = eventData.Entity; var entity = eventData.Entity;
if (entity.UnplannedIssueType == EnumUnplannedIssueType.Raw)
{
await AddExpectOutsAsync(entity).ConfigureAwait(false);
}
//if (entity.AutoSubmit) //if (entity.AutoSubmit)
//{ //{
// await _unplannedIssueRequestManager.SubmitAsync(entity).ConfigureAwait(false); // await _unplannedIssueRequestManager.SubmitAsync(entity).ConfigureAwait(false);
@ -53,6 +66,10 @@ public class UnplannedIssueRequestEventHandler
if (entity.AutoSubmit) if (entity.AutoSubmit)
{ {
await _unplannedIssueRequestManager.SubmitAsync(entity).ConfigureAwait(false); await _unplannedIssueRequestManager.SubmitAsync(entity).ConfigureAwait(false);
if(entity.UnplannedIssueType== EnumUnplannedIssueType.Raw)
{
await AddExpectOutsAsync(entity).ConfigureAwait(false);
}
} }
} }
} }
@ -80,9 +97,53 @@ public class UnplannedIssueRequestEventHandler
await _unplannedIssueJobApp.CreateAsync(job).ConfigureAwait(false); await _unplannedIssueJobApp.CreateAsync(job).ConfigureAwait(false);
} }
} }
public virtual async Task HandleEventAsync(SfsRefusedEntityEventData<UnplannedIssueRequest> eventData)
{
var entity = eventData.Entity;
if (entity.UnplannedIssueType == EnumUnplannedIssueType.Raw)
{
await ExpectOutAppService.RemoveAsync(entity.Number).ConfigureAwait(false);
}
}
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<UnplannedIssueRequest> eventData)
{
var entity = eventData.Entity;
if (entity.UnplannedIssueType == EnumUnplannedIssueType.Raw)
{
await ExpectOutAppService.RemoveAsync(entity.Number).ConfigureAwait(false);
}
}
public virtual async Task HandleEventAsync(SfsCancelledEntityEventData<UnplannedIssueRequest> eventData)
{
var entity = eventData.Entity;
if (entity.UnplannedIssueType == EnumUnplannedIssueType.Raw)
{
await ExpectOutAppService.RemoveAsync(entity.Number).ConfigureAwait(false);
}
}
#region 私有 #region 私有
private async Task AddExpectOutsAsync(UnplannedIssueRequest entitie)
{
var expectOuts = new List<ExpectOutEditInput>();
var entityExpectOuts = BuildExpectOutInventoryAsync(entitie);
expectOuts.AddRange(entityExpectOuts);
await ExpectOutAppService.AddManyAsync(expectOuts).ConfigureAwait(false);
}
private List<ExpectOutEditInput> BuildExpectOutInventoryAsync(UnplannedIssueRequest request)
{
var inputs = ObjectMapper.Map<List<UnplannedIssueRequestDetail>, List<ExpectOutEditInput>>(request.Details);
foreach (var input in inputs)
{
input.JobNumber = request.Number;
input.Worker = request.Worker;
}
return inputs;
}
private async Task<UnplannedIssueNoteEditInput> BuildUnplannedIssueNoteCreateInputAsync( private async Task<UnplannedIssueNoteEditInput> BuildUnplannedIssueNoteCreateInputAsync(
UnplannedIssueRequest entity) UnplannedIssueRequest entity)
{ {
@ -120,6 +181,8 @@ public class UnplannedIssueRequestEventHandler
return createInput; return createInput;
} }
/* AutoMapper实现 /* AutoMapper实现
private void SetUnplannedIssueJobDetails(UnplannedIssueJobCreateInput createInput, List<UnplannedIssueRequestDetail> details) private void SetUnplannedIssueJobDetails(UnplannedIssueJobCreateInput createInput, List<UnplannedIssueRequestDetail> details)
{ {

20
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/UnplannedIssueNoteEventHandler.cs

@ -1,12 +1,15 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
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.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Event.Inventories;
using Win_in.Sfs.Wms.Store.Event.Transaction; using Win_in.Sfs.Wms.Store.Event.Transaction;
namespace Win_in.Sfs.Wms.Store.Event.Transactions; namespace Win_in.Sfs.Wms.Store.Event.Transactions;
@ -35,6 +38,10 @@ public class UnplannedIssueNoteEventHandler
if (!string.IsNullOrEmpty(entity.UnplannedIssueRequestNumber)) if (!string.IsNullOrEmpty(entity.UnplannedIssueRequestNumber))
{ {
await _unplannedIssueRequestApp.CompleteByNumberAsync(entity.UnplannedIssueRequestNumber).ConfigureAwait(false); await _unplannedIssueRequestApp.CompleteByNumberAsync(entity.UnplannedIssueRequestNumber).ConfigureAwait(false);
if (entity.UnplannedIssueType == EnumUnplannedIssueType.Raw)
{
await ExpectOutAppService.RemoveAsync(entity.UnplannedIssueRequestNumber).ConfigureAwait(false);
}
} }
} }
@ -53,11 +60,11 @@ public class UnplannedIssueNoteEventHandler
{ {
var entities = eventData.Entity; var entities = eventData.Entity;
await AddTransactionsAsync(entities).ConfigureAwait(false); await AddTransactionsAsync(entities).ConfigureAwait(false);
await RemoveExpectOut(entities).ConfigureAwait(false);
} }
private async Task AddTransactionsAsync(List<UnplannedIssueNote> unplannedIssueNotes) private async Task AddTransactionsAsync(List<UnplannedIssueNote> unplannedIssueNotes)
{ {
var inboundTransactions = new List<TransactionEditInput>(); var inboundTransactions = new List<TransactionEditInput>();
//如果要做库存事务汇总,可以修改此处 //如果要做库存事务汇总,可以修改此处
@ -69,6 +76,17 @@ public class UnplannedIssueNoteEventHandler
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false); await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false);
} }
private async Task RemoveExpectOut(List<UnplannedIssueNote> unplannedIssueNotes)
{
foreach (var unplannedIssueNote in unplannedIssueNotes)
{
if (unplannedIssueNote.UnplannedIssueType == EnumUnplannedIssueType.Raw)
{
await ExpectOutAppService.RemoveAsync(unplannedIssueNote.UnplannedIssueRequestNumber).ConfigureAwait(false);
}
}
}
private List<TransactionEditInput> BuildTransactions(UnplannedIssueNote unplannedIssueNote) private List<TransactionEditInput> BuildTransactions(UnplannedIssueNote unplannedIssueNote)
{ {
var transactions = new List<TransactionEditInput>(); var transactions = new List<TransactionEditInput>();

Loading…
Cancel
Save