Browse Source

新增装配发料TYPR接口

dev_DY_CC
周红军 1 year ago
parent
commit
bd6ddfc088
  1. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs
  2. 107
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs
  3. 10
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs
  4. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs

@ -41,5 +41,9 @@ public enum EnumExchangeDataType
/// 涂装发料
/// </summary>
CoatingIssue=31,
/// <summary>
/// 装配发料
/// </summary>
AssembleIssue=32,
}

107
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs

@ -0,0 +1,107 @@
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;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Notes.IssueNotes;
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges;
/// <summary>
/// 装配发料记录传给TYRP(线边仓领料单)
/// </summary>
public class AssembleIssueNoteEventHandler
: StoreDataExchangeEventHandlerBase<AssembleIssueNote>
, ILocalEventHandler<SfsCreatedEntityEventData<AssembleIssueNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<AssembleIssueNote>>>
{
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.AssembleIssue;
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<AssembleIssueNote> eventData)
{
var entity = eventData.Entity;
await AddExchangeDataAsync(entity).ConfigureAwait(false);
}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<AssembleIssueNote>> eventData)
{
var entities = eventData.Entity;
await AddExchangeDataAsync(entities).ConfigureAwait(false);
}
protected override async Task AddExchangeDataAsync(List<AssembleIssueNote> entities)
{
var dtos = ObjectMapper.Map<List<AssembleIssueNote>, List<AssembleIssueNoteDTO>>(entities);
foreach (var detail in dtos.SelectMany(dto => dto.Details))
{
if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode))
{
var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false);
if (location != null)
{
detail.HandledFromLocationErpCode = location.ErpLocationCode;
detail.HandledFromLocationGroup = location.LocationGroupCode;
detail.HandledFromLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode))
{
detail.HandledFromWarehouseCode = location.WarehouseCode;
}
}
}
if (string.IsNullOrEmpty(detail.HandledToLocationErpCode))
{
var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false);
if (location != null)
{
detail.HandledToLocationErpCode = location.ErpLocationCode;
detail.HandledToLocationGroup = location.LocationGroupCode;
detail.HandledToLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledToWarehouseCode))
{
detail.HandledToWarehouseCode = location.WarehouseCode;
}
}
}
}
var toErpDto = new List<AssembleIssueNoteDTO>();
foreach (var item in dtos)
{
if (item.Details != null && item.Details.Count != 0)
{
toErpDto.Add(item);
}
}
//2023-12-6要求同储位不传入接口 按历史规则
var result = new List<AssembleIssueNoteDTO>();
foreach (var assembleIssueNoteDto in toErpDto)
{
assembleIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode);
if (assembleIssueNoteDto.Details.Count > 0)
{
result.Add(assembleIssueNoteDto);
}
}
if (result.Count > 0)
{
var exchangeDataerp =
await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result)
.ConfigureAwait(false);
await AddManyAsync(exchangeDataerp).ConfigureAwait(false);
}
}
}

10
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs

@ -12,7 +12,7 @@ using Win_in.Sfs.Wms.Store.Notes.IssueNotes;
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges;
/// <summary>
/// 涂装发料记录传给TYRP(线边领料单)
/// 涂装发料记录传给TYRP(线边领料单)
/// </summary>
public class CoatingIssueNoteEventHandler
: StoreDataExchangeEventHandlerBase<CoatingIssueNote>
@ -86,12 +86,12 @@ public class CoatingIssueNoteEventHandler
//2023-12-6要求同储位不传入接口 按历史规则
var result = new List<CoatingIssueNoteDTO>();
foreach (var injectionIssueNoteDto in toErpDto)
foreach (var coatingIssueNoteDto in toErpDto)
{
injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode);
if (injectionIssueNoteDto.Details.Count > 0)
coatingIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode);
if (coatingIssueNoteDto.Details.Count > 0)
{
result.Add(injectionIssueNoteDto);
result.Add(coatingIssueNoteDto);
}
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs

@ -11,7 +11,7 @@ using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges;
/// <summary>
/// 注塑发料记录传给TYRP(线边领料单)
/// 注塑发料记录传给TYRP(线边领料单)
/// </summary>
public class InjectionIssueNoteEventHandler
: StoreDataExchangeEventHandlerBase<InjectionIssueNote>

Loading…
Cancel
Save